<!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 i=setInterval("clock()",100);
      
   function Stop(){
       window.clearInterval(i);
   }
</script>
</head>
<body>
  <form>
    <input type="text" id="clock" size="50"  />
    <input type="button" value="Stop" onclick="clearInterval(i)"   />
  </form>
</body>
</html>
可以定义stop函数 但是如果你要停止函数外面的值 你就需要传入值给需要调用的函数
所以你在stop函数传入一个i 然后调用stop函数也是一样的
function Stop(i){
       window.clearInterval(i);
   }
不需要定义stop()函数啊