<body bgcolor="#fef4d9" OnLoad="timeIt()">
<SCRIPT LANGUAGE="JavaScript">function Minutes(data) {
for (var i = 0; i < data.length; i++)
if (data.substring(i, i + 1) == ":")
break;
return (data.substring(0, i));
}
function Seconds(data) {
for (var i = 0; i < data.length; i++)
if (data.substring(i, i + 1) == ":")
break;
return (data.substring(i + 1, data.length));
}
function Display(min, sec) {
var disp;
if (min <= 9) disp = " 0";
else disp = " ";
disp += min + ":";
if (sec <= 9) disp += "0" + sec;
else disp += sec; 
return (disp);
}
function Down() { 
sec--;      
if (sec == -1) { sec = 59; min--; }
document.timerform.clock.value = Display(min, sec);
window.status = "Session will time out in: " + Display(min, sec);
if (min == 0 && sec == 0) {
alert("Your session has timed out.");
window.location.href = timedouturl;
}
else down = setTimeout("Down()", 1000);
}
function timeIt() {
min = 1 * Minutes(document.timerform.clock.value);
sec = 0 + Seconds(document.timerform.clock.value);
Down();
}</script>
<center>
<form name="timerform">
<input type="text" name="clock" size="7" value="2:00"><p>
</form>
</center>

解决方案 »

  1.   

    <script>
    var time=6;
    function woyingjie(){
    document.getElementById("o").innerText=time
    time-=1
    if(time<=0){
    document.form1.submit();
    }
    else{
    setTimeout("woyingjie()",1000);
    }
    }
    </script>
    <body onload=woyingjie()>
    <div id=o></div>
    <form name=form1 action=index.asp>
     <input type=submit value=提交>
    </form>
      

  2.   

    可隐藏一些东东
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <meta name="GENERATOR" content="Microsoft FrontPage 6.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <link rel=stylesheet href="css.css">
    <title>New Page 1</title>
    </head>
    <script Language="JavaScript">
    <!--Hide these  preventing old browser to show 
     function show()
     {
      form.submit();
      form.action="dsyd.asp";
     }
     function disp()
     {
      clock=setTimeout("show()",120000);
     }
    //hiding ended-->
    </script><body onload="disp()" leftmargin="22" background="../../../data/image2/yd_backgr.jpg" bgproperties="fixed">
    <p id = "oTime" name="oTime"  style="position: absolute; top: 15; left: 69; width: 96; height: 56; background-color: #66ffff; border: 1px solid blue" align="center">
    <br>
    <span id = "sTime"></span>
    </p><form method="POST" id="form"  action="dsyd.asp">
      
    <p> </p>  
    <div align="center">
      <center>
      <table border="0" width="100%" height="28" cellspacing="0" cellpadding="0" style="border-collapse: collapse" bordercolor="#111111">
        <tr>
          <td width="620" height="28">
      
    <p><span lang="EN-US"><strong><font size="5" face="Times New Roman">Questions 1 and 2 are based on the          
    following passage</font></strong></span></p>         
    <p class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph; font-size: 10.5pt; font-family: Times New Roman; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; margin-bottom: .0001pt">      
    <span lang="EN-US" style="font-size: 12.0pt"><font face="Times New Roman" size="3">&nbsp;</font></span></p>      
    <p class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph; font-size: 10.5pt; font-family: Times New Roman; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; margin-bottom: .0001pt">      
    <span lang="EN-US" style="font-size:12.0pt;mso-bidi-font-size:
    10.0pt"><font face="Times New Roman" size="3">1. </font> </span><font face="Times New Roman" size="3"><span lang="EN-US" style="font-size:12.0pt;mso-bidi-font-size:10.0pt">From   
    the mid-1860s to the mid-1880s, higher education in the United States</span><span lang="EN-US" style="font-size:12.0pt;mso-bidi-font-size: 
    10.0pt"> ________.</span></font></p>      
    <p class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph; font-size: 10.5pt; font-family: Times New Roman; margin-top: 8; margin-bottom: 8">      
    <font face="Times New Roman" size="3">      
    <br>     
    <span lang="EN-US" style="font-size: 12.0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;             
          <input type="radio" value="A" name="text1" ><span lang="EN-US" style="font-size:12.0pt;mso-bidi-font-size:   
    10.0pt;font-family:&quot;Times New Roman&quot;;mso-fareast-font-family:宋体;mso-font-kerning:   
    1.0pt;mso-ansi-language:EN-US;mso-fareast-language:ZH-CN;mso-bidi-language:   
    AR-SA">A. </span></span><span lang="EN-US" style="font-size:12.0pt;mso-bidi-font-size:10.0pt">was   
    changed and modernized</span><span lang="EN-US" style="font-size: 12.0pt">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></font></p>       
    <p class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph; font-size: 10.5pt; font-family: Times New Roman; margin-top: 8; margin-bottom: 8"><font face="Times New Roman" size="3"><span style="font-size: 12.0pt" lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;   
    <input type="radio" value="B" name="text1"><span lang="EN-US" style="font-size:12.0pt;mso-bidi-font-size: 
    10.0pt;font-family:&quot;Times New Roman&quot;;mso-fareast-font-family:宋体;mso-font-kerning: 
    1.0pt;mso-ansi-language:EN-US;mso-fareast-language:ZH-CN;mso-bidi-language: 
    AR-SA">B. </span></span><span lang="EN-US" style="font-size:12.0pt;mso-bidi-font-size:10.0pt">was   
    in a chaos</span></font></p>       
    <p class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph; font-size: 10.5pt; font-family: Times New Roman; margin-top: 8; margin-bottom: 8">      
    <span lang="EN-US" style="font-size: 12.0pt"><font face="Times New Roman" size="3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;             
          <input type="radio" value="C" name="text1"><span lang="EN-US" style="font-size:12.0pt;mso-bidi-font-size:   
    10.0pt;font-family:&quot;Times New Roman&quot;;mso-fareast-font-family:宋体;mso-font-kerning:   
    1.0pt;mso-ansi-language:EN-US;mso-fareast-language:ZH-CN;mso-bidi-language:   
    AR-SA">C. </span></font></span><font face="Times New Roman" size="3"><span lang="EN-US" style="font-size:12.0pt;mso-bidi-font-size:10.0pt">was  
    in need of money</span></font></p>       
          </td>
        </tr>
      </table>
      </center>
    </div>
     
      <div align="right">
        <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="132" height="96">
          <tr>
            <td width="167" height="76" align="center" id="aaa"> </td>
          </tr>
        </table>
    </div>
      <p align="center">
      
      <input type="submit" value="提交" name="B1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;   
      <input type="reset" value="全部重写" name="B2">
      </p>
      <p align="center">
      
       
      </p>
    </form>
    </body>
    <script language="javascript">
    <!--
    var totalSecond=119;
    var oTimeTop =oTime.style.pixelTop;
    var ss = setInterval(function()
    {
    if(totalSecond==0)
    {
    sTime.innerHTML="<font color='red'>您的答题时间已到。</font>"
    //alert("time is up");
    clearInterval(ss);
    }
    else
    {
    var fen=totalSecond/60;
        if (fen<1)
        {
        sTime.innerHTML="您的答题时间还有:<font color='red'>"+totalSecond +"秒</font>";
        }
        else if(fen==1)
        {
        sTime.innerHTML="您的答题时间还有:<font color='red'>1 分钟</font>";
        }
        else if(fen>1)
        {
        second=totalSecond-60;
        sTime.innerHTML="您的答题时间还有:<font color='red'>1 分 "+ second+" 秒</font>";
        }
    totalSecond--;
    }
    },1000);document.body.onscroll=function()
    {
    oTime.style.top = oTimeTop+ document.body.scrollTop;
    }//-->
    </script>
     <script>
     function a1()
     {
       
         aaa.innerHTML="<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='132' height='96'><param name='movie' value='../../../swf/5-1.swf'><param name='quality' value='high'><embed src='../../../swf/5-1.swf' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='132' height='96'></embed></object>  ";
     
     }
     
     function b1()
     {
     
     aaa.innerHTML="";
     
     }
     
     
     
     
     
     function a2()
     {
     
     aaa.innerHTML="<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='132' height='96'><param name='movie' value='../../../swf/5-2.swf'><param name='quality' value='high'><embed src='../../../swf/5-2.swf' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='132' height='96'></embed></object>  ";
     
     }
     
     function b2()
     {
     aaa.innerHTML=""; }
     </script>
    </html>