问答详情
源自:8-4 取消计时器clearInterval()

为什么右边不显示时间?

<!DOCTYPE HTML>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<title>计时器</title>

<script type="text/javascript">

   function clock(){

      var time=new Date();                

      document.getElementById("clock").value = time;

   }

   var int=setInetval(clock,1000);  

</script>

</head>

<body>

  <form>

    <input type="text" id="clock" size="50"  />

    <input type="button" value="Stop" 

    onclick="clearInterval(int)"/>

  </form>

</body>

</html>


提问者:YuzuruHanyu 2016-05-15 07:47

个回答

  • 慕码人3742078
    2016-05-15 09:58:33
    已采纳

    var int=setInetval(clock,1000);  

    这句写错了吧,应该是var int=setInterval(clock,1000);