<html>
<head>
<title>Javascript???的????</title>
</head>
<body>
<script language="JavaScript">
<!--
    var timerId = 0;
    function showClock(cb){
        if (cb.checked){
            showTime();
            timerId = setInterval(showTime, 1000);   
        }else{
            document.form1.disp.value = "";
            clearInterval(timerId);
        }
    }
  
    function showTime() {
        d = new Date();   
        var h = d.getHours();
        var m = d.getMintes();
        var s = d.getSeconds();        document.form1.rad.value = h+":"m+":"s+":";
        document.form1.disp.value  =  d.toLocaleString();
         }
//-->
</SCRIPT>
<form name="form1">
    <input type="text" name="disp" value="" size="30" >
    <input type="checkbox" name="rad" onClick="showClock(this)">
</form>
</body>
</html>
我只想显示 时间  这些 甚么都不显示
求大大给予改正

解决方案 »

  1.   

    都是语法、拼写上的小问题,都是不仔细造成的,但愿以后自己能检查一遍。<!DOCTYPE html
         PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
      <meta http-equiv="Content-Type" content="text/html; charset=gbk" />
      <title> new document </title>
    </head>
    <script type="text/javascript">
      var timerId = 0;  function showClock(cb) {
        if (cb.checked){
          showTime();
          timerId = setInterval(showTime, 1000);
        } else {
          document.form1.disp.value = "";
          clearInterval(timerId);
        }
      }  function showTime() {
        var d = new Date();
        var h = d.getHours();
        var m = d.getMinutes();  // 这里你拼写错了!
        var s = d.getSeconds();
        document.form1.rad.value = h + ":" + m + ":" + s + ":";  // 这里你少了几个“+”
        document.form1.disp.value = d.toLocaleString();
      }
    </script><body>
    <form name="form1">
      <input type="text" name="disp" value="" size="30" >
      <input type="checkbox" name="rad" onClick="showClock(this)">
    </form>
    </body>
    </html>