<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script   language="javascript"> 
var tim; 
function   dytime()
{
 tim=document.form1.times.value;  
   if(!isNaN(tim))
   {
   timeLeft       =       tim       *     60       *       1000;               //此处总是报NAN错误
   }
   else
   {
   alert("error");
   return false;
   }
   countTime();
}
    function       countTime()      
    {        if(timeLeft       ==       0)      
    {      
      alert("時間になります!");      
      document.form1.submit();  
    }      
     var       startMinutes       =       parseInt(timeLeft       /       (60       *       1000),       10);      
     var       startSec       =       parseInt((timeLeft       -       startMinutes       *       60       *       1000)/1000)      
     document.form1.xiao.innerText       =       "試験余り時間:"       +       startMinutes       +       "分間"       +       startSec       +       "秒";      
      timeLeft       =       timeLeft       -       1000;      
     setTimeout('countTime()',1000);  
      }  
</script> 
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>Untitled Document</title>
</head><body>
<form name="form1">
<input type="text" name="times" >
<input type="text" name="xiao" >
<input type="button" onClick="dytime();"
</form></body>
</html>

解决方案 »

  1.   

    完善了一下:
    <%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <script   language="javascript"> 
    var tim,time1; 
    function   dytime()
    {
    clearTimeout(time1);
    document.form1.xiao.innerText ="";
     tim=document.form1.times.value;  
       if(!isNaN(tim))
       {
       timeLeft       =       tim       *     60       *       1000;               //此处总是报NAN错误
       }
       else
       {
       alert("error");
       return false;
       }
       countTime();
    }
        function       countTime()      
        {        if(timeLeft       ==       0)      
        {      
          alert("時間になります!");      
          document.form1.submit();  
        }      
         var       startMinutes       =       parseInt(timeLeft       /       (60       *       1000),       10);      
         var       startSec       =       parseInt((timeLeft       -       startMinutes       *       60       *       1000)/1000)      
         document.form1.xiao.innerText       =       "試験余り時間:"       +       startMinutes       +       "分間"       +       startSec       +       "秒";      
          timeLeft       =       timeLeft       -       1000;      
         time1=setTimeout('countTime()',1000);  
          }  
    </script> 
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>Untitled Document</title>
    </head><body>
    <form name="form1">
    <input type="text" name="times" >
    <input type="text" name="xiao" >
    <input type="button" onClick="dytime();"
    </form></body>
    </html>
      

  2.   

    to he_8134:
    说实话很惭愧,也就是运气好赶上了时候
      

  3.   

    <%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <script   language="javascript"> 
    var tim; 
    function   dytime()
    {
     tim=document.form1.times.value;  
       if(!isNaN(tim))
       {
       timeLeft       =       tim       *     60       *       1000;               //此处总是报NAN错误
       }
       else
       {
       alert("error");
       return false;
       }
       countTime();
    }
        function       countTime()      
        {        if(timeLeft       ==       0)      
        {      
          alert("時間になります!");      
          document.form1.submit();  
        }      
         var       startMinutes       =       parseInt(timeLeft       /       (60       *       1000),       10);      
         var       startSec       =       parseInt((timeLeft       -       startMinutes       *       60       *       1000)/1000)      
         document.form1.xiao.innerText       =       "試験余り時間:"       +       startMinutes       +       "分間"       +       startSec       +       "秒";      
          timeLeft       =       timeLeft       -       1000;      
         setTimeout('countTime()',1000);  
          }  
    </script> 
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>Untitled Document</title>
    </head><body>
    <form name="form1">
        <input type="text" name="times" >
        <input type="text" name="xiao" >
        <input type="button" onClick="dytime();"
        </form></body>
    </html>