畢業設計應用

q353249438發表於2020-04-04

[table] || [/table]

<script language="javascript">
<!--考試時間-->
var loops = 0;
var timevalue=120;
var min1=-1;
var sec1=0;
var tmpobj = setInterval("addtime()",1000);
var timeout;
function addtime() {
loops--;
sec1++;
if ((sec1==1)||(sec1==2)||(sec1==3)||(sec1==4)||(sec1=5)||(sec1==6)||(sec1==7)||(sec1==8)||(sec1==0))
timeout=min1+"分鐘0"+sec1+"秒";
else
timeout=min1+"分鐘"+sec1+"秒";
if((timevalue<=0)&&(loops==0)) {
document.myform.timeout.value=timeout;
alert("提示:\n\n考試時間到,系統將強迫停止考試!");
clearInterval(tmpobj);
ExamSubmit();
}
else{
if (loops<0)
 {
 loops=59;
 sec1=0;
 timevalue--;
 min1++;
 }
 if ((loops==1)||(loops==2)||(loops==3)||(loops==4)||(loops==5)||(loops==6)||(loops==7)||(loops==8)||(loops==9))
{
 Time1.innerHTML="<font color=red>"+timevalue+"</font>分鐘<font color=red>0"+loops+"</font>秒";
 }
else
 {
Time1.innerHTML="<font color=red>"+timevalue+"</font>分鐘<font color=red>"+loops+"</font>秒";
}
if ((timevalue==20) && (loops==0))
{
alert("提示:\n\n考試時間還剩二十分鐘,請抓緊時間做題!");
}
if ((timevalue==5) && (loops==0))
{
alert("提示:\n\n考試時間還剩最後五分鐘,請做好儲存!");
}
}
}
</script>

 

相關文章