<div id="timer" style="color:red"></div>
<script>
var timer = setInterval("CountDown()",1000);
var maxtime = $("#mytime").val()*60; //一个小时,按秒计算,自己调整!
function CountDown(){
if(maxtime>=0){
minutes = Math.floor(maxtime/60);
seconds = Math.floor(maxtime%60);
msg = "距离结束还有"+minutes+"分"+seconds+"秒";
document.all["timer"].innerHTML=msg;
if(maxtime == 5*60) alert('注意,还有5分钟!');
--maxtime;
}
else{
clearInterval(timer);
alert("时间到,考试结束,系统自动交卷!");
var paperid= $("#paperid").val();
window.location.href="userExam.do?act=submitExamOver&paperid="+paperid;
}
}
</script>
考试倒计时计时器
最新推荐文章于 2019-08-21 21:28:00 发布