如何管理在线考试的时间。 [英] How to manage time in online exam.
问题描述
假设30分钟目标类型在线考试。
一旦用户登录并点击开始考试计时器开始。
但是如果用户关闭标签并重新打开标签然后这个计时器再次启动。
我该如何防止这样做!
即用户还有最后10分钟,他会重新打印页面或关闭标签并重新打开该标签
我如何管理时间。这将不会再次从30分钟开始。
i看到一些倒数计时器,但是当我重新打印页面时,它会从全职时间再次开始。
我的尝试:
var timer2 =30:00;
var interval = setInterval(function(){
var timer = timer2.split(':');
//通过解析整数,我避免所有额外的字符串处理
var minutes = parseInt(timer [0],10);
var seconds = parseInt(timer [1],10);
- 秒;
分钟=(秒<0)? - 分钟:分钟;
if(分钟< 0)clearInterval(间隔);
秒=(秒< 0)?59:秒;
秒=(秒< 10)?'0'+秒:秒;
//分钟=(分钟< 10)?分钟:分钟;
$('。countdown')。 HTML(分s +':'+秒);
timer2 =分钟+':'+秒;
if(分钟== 0& ;&安培;秒== 0)
{
alert('考试完成');
window.location.href =/ home / FirstQuestion ;
}
},1000);
suppose 30 min objective type online exam.
once user login and click on start exam timer start.
but if user close tab and re-open tab then this timer start again.
how can i prevent to do !
i.e user has last 10 min left and he refress page or close tab and reopen that tab
how i manage time. that it will not start from 30 min again.
i see some countdown timer but when i refress page it's start again from full time.
What I have tried:
var timer2 = "30:00";
var interval = setInterval(function () {
var timer = timer2.split(':');
//by parsing integer, I avoid all extra string processing
var minutes = parseInt(timer[0], 10);
var seconds = parseInt(timer[1], 10);
--seconds;
minutes = (seconds < 0) ? --minutes : minutes;
if (minutes < 0) clearInterval(interval);
seconds = (seconds < 0) ? 59 : seconds;
seconds = (seconds < 10) ? '0' + seconds : seconds;
//minutes = (minutes < 10) ? minutes : minutes;
$('.countdown').html(minutes + ':' + seconds);
timer2 = minutes + ':' + seconds;
if(minutes == 0 && seconds == 0)
{
alert('Exam Finished');
window.location.href = "/home/FirstQuestion";
}
}, 1000);
推荐答案
('。countdown')。html(分钟) +':'+秒);
timer2 =分钟+':'+秒;
if(分钟== 0& & seconds == 0)
{
alert('考试完成');
window.location.href =/ home / FirstQuestion;
}
},1000);
('.countdown').html(minutes + ':' + seconds);
timer2 = minutes + ':' + seconds;
if(minutes == 0 && seconds == 0)
{
alert('Exam Finished');
window.location.href = "/home/FirstQuestion";
}
}, 1000);
将用户登录到服务器上的考试,并记录在那里开始时间。然后服务器根据需要关闭考试。
基于服务器的考试计时器MVC4 - Google搜索 [ ^ ]
Log the user in to the exam on the server, and record the start time there. The server then closes the exam as necessary.
server based exam timer MVC4 - Google Search[^]
这篇关于如何管理在线考试的时间。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!