<SCRIPT  language="JavaScript">  
<!--    
function  display(){  
rtime=etime-ctime;  
if  (rtime>60)  
m=parseInt(rtime/60);  
else{  
m=0;  
}  
s=parseInt(rtime-m*60);  
if(s<10)  
s="0"+s  
window.status="时间还剩  :    "+m+":"+s  
window.setTimeout("checktime()",1000)  
}  
 
function  settimes(){  
var  shij=document.Form1.tb1.value;  
alert("开始考试!")  
var  time=  new  Date();  
hours=  time.getHours();  
mins=  time.getMinutes();  
secs=  time.getSeconds();  
etime=hours*3600+mins*60+secs;  
etime+=shij*60;    //You  can  change  the  value  of  1200  according  to  how  much  time  you  wish  to  set  the  timer.  Where  1200  is  time  in  secs  (1200  =  20  mins  *  60  secs/min).  Max  time  is  60  mins  (3600secs)  
checktime();  
}  
 
function  checktime(){  
var  time=  new  Date();  
hours=  time.getHours();  
mins=  time.getMinutes();  
secs=  time.getSeconds();  
ctime=hours*3600+mins*60+secs  
if(ctime>=etime){  
expired();  
}  
else  
display();  
}  
 
function  expired(){  
alert("交卷时间已到了,系统将自动交卷");  
//document.Form1.submit;  
document.Form1.Button2.click;  
//location.href="score.aspx";    //Put  here  the  next  page  
}  
document.oncontextmenu=settimes();  
//  Done  hiding  -->  
                       </SCRIPT>  
 
document.Form1.Button2.click;为什么这句没有作用啊??????  
要怎么样才可以?

解决方案 »

  1.   

    document.Form1.submit; 为什么也没有作用
      

  2.   

    document.Form1.Button2.click();
    document.Form1.submit();
      

  3.   

    location.href="score.aspx";    
    有作用吗?document.Form1.Button2.click;为什么这句没有作用啊??????  
    Button2的click事件存在吗?
      

  4.   

    location.href="score.aspx"; 有作用啊。但是转到另一个界面后怎么传值呢?(因为是在在线考试所以要传的值比较多)
      

  5.   

    TO:jimu8130(yang) 
    Button2是HTML控件。
    你能给个解决方案吗?