拼写错误/优化一下子(未经FF测试)<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-CN" lang="zh-CN">
<head> 
</head> 
<body> 
<script lanuage="JavaScript"> 
//var enabled=0
var TM; 
function Time_Set(){ 
//TM=windows.setTimeout("Time_Set()",1000); //err=s
TM=window.setTimeout("Time_Set()",1000); 
var today=new Date(); 
//document.clock.disp.value=tody.toLocaleString;//err=()
document.clock.disp.value=today.toLocaleString();} 
</script> 
<!--form--> 
<form name=clock> 
<input type="text" name="disp" value="" size=30 onFocus="this.blur()"> <input type="button" name="rad" value="off" onclick=" 
//if(enabled==1){ 
clearTimeout(TM); 
//enabled=0; 
document.clock.disp.value=''; 
/////////////////clearTimeout{TM};//err={} 
//}
"> 
<!--input type="button" name="rad1" value="on" onclick=" if(enabled==0){ var TM=setTimeout('Time_Set()',1000);enabled=1;}"--> 
<input type="button" name="rad1" value="on" onclick=" setTimeout('Time_Set()',1000);//enabled=1;"> 
</form> 
</body> 
</html> 

解决方案 »

  1.   

    参考:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-CN" lang="zh-CN">
    <head> 
    <script lanuage="JavaScript"> 
    var TM; 
    function Time_Set(){ 
    TM=window.setTimeout("Time_Set()",1000); 
    var today=new Date(); 
    document.getElementById('disp').value=today.toLocaleString();

    </script> 
    </head> 
    <body> 
    <input type="text" id="disp" name="disp" value="" size=30 onFocus="this.blur()"> 
    <input type="button" name="rad" value="off" onclick=" clearTimeout(TM); document.getElementById('disp').value=''; "> 
    <input type="button" name="rad1" value="on" onclick=" setTimeout('Time_Set()',1000);"> 
    </body> 
    </html> 
      

  2.   

    <html>
    <head>
    </head>
    <body>
    <script lanuage="JavaScript">
    enabled=0;
     function Time_Set(){
     TM=window.setTimeout("Time_Set()",1000);
     var today=new Date();
     document.clock.disp.value=tody.toLocaleString();}
    </script>
    <form>
    <input type="text" name="disp" value="" size=30 onFocus="this.blur()">
    <input type="button" name="rad" value="off" onclick="
     if(enabled==1){
     document.clock.disp.value='';
     clearTimeout(TM);
     enabled=0;
    }">
    <input type="button" name="rad1" value="on" onclick="
     if(enabled==0){
     var TM=setTimeout('Time_Set()',1000);
     enabled=1;}">
    </form>
    </body>
    </html>点击ON仍然不能显示时间
      

  3.   


    <html>
    <head>
    </head>
    <body>
    <script lanuage="JavaScript">
    enabled=0;
     function Time_Set(){
     TM=window.setTimeout("Time_Set()",1000);
     var today=new Date();
    // document.clock.disp.value=tody.toLocaleString();//err=a
     document.clock.disp.value=today.toLocaleString();
     
     }
    </script>
    <!--form--><!--err=name-->
    <form name=clock>
    <input type="text" name="disp" value="" size=30 onFocus="this.blur()">
    <input type="button" name="rad" value="off" onclick="
     if(enabled==1){
     document.clock.disp.value='';
     clearTimeout(TM);
     enabled=0;
    }">
    <input type="button" name="rad1" value="on" onclick="
     if(enabled==0){
     var TM=setTimeout('Time_Set()',1000);
     enabled=1;}">
    </form>
    </body>
    </html>
      

  4.   

    感觉问的问题,一点javascript 基础都没