在线测验时如何防止向后导航按钮 [英] How to prevent backward navigation button while writing online Quiz

查看:86
本文介绍了在线测验时如何防止向后导航按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI,



我正在开发一个在线测验应用程序。



我有10个问题。当用户点击开始考试按钮时,考试将开始,问题将逐一显示。每个问题的时间限制为60秒。



我有一个名为QUIZ.aspx的页面,我将逐一显示问题。



现在的问题是,在编写考试时,如果按下后退按钮,我可以查看上一个问题。我需要在编写考试时阻止向后导航按钮。



Caqn任何人帮助我。如果可能的话,请向我提供代码。



I am developing an online quiz application.

I have 10 questions. When the user clicks the start exam button the exam will start and the questions will be displayed one by one. There is a time limit of 60 sec for every question.

I have a page called QUIZ.aspx where i am displaying questions one by one.

Now the problem is, while writing the exam, if i press back button, i am able to view the previous question. I need to block the backward navigation button while writing the exam.

Caqn any one help me. If possible, please provide me with the code.

推荐答案

使用后面的代码在您想要阻止的页面(头部)上使用后退按钮。

Use the below code on the page(head) which you want to prevent to be landed using back button.
<script type="text/javascript">
  function preventBack() { window.history.forward(); }
  setTimeout("preventBack()", 0);
  window.onunload = function() { null };
</script>

<script language="JavaScript" type="text/javascript">
  javascript: window.history.forward(1);
</script>



问候:笑:


Regards :laugh:


这篇关于在线测验时如何防止向后导航按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆