以下代码运行是正确的,但当考试时间到的时候,页面只是刷新但不提交,请问是怎么回事呢?
<script language=javascript>
<!--
var sec=0;var min=0;var flag=0;
function update() {
sec=sec+1;if(sec> =60){sec=0;min+=1;}
document.acount.face.value=min+ " 分 "+sec+ " 秒 ";idt=window.setTimeout( "update(); ",1000);
if((min==document.test_time.value-5)&&(flag==0)){window.alert( "还差5分钟考试结束,请按时完成试题 ");flag=1;}
if(min==document.test_time.value){document.acount.submit();}
}
//-->
</script>
<input type= "text " name= "face " size= "8 " value= "0分0 ">
------解决方案--------------------------------------------------------
document.acount.submit();}
改成document.all.buttonId.click()
try...