我想做一个可以通过按钮随意开始和终止时间的代码,但是结束不了,怎么回事呢?
<!DOCTYPE HTML>
<html>
<head>
<script>
function kaishi(){
var abb= new Date();
document.getElementById("con").value=abb;
var i=setInterval(kaishi,1000);
}
</script>
</head>
<body>
<input type ="text" id="con" size="60"/>
<input type="button" value="jieshu" onclick="clearInterval(i)" />
<input type ="button" value="start" onclick="kaishi()" />
</body>
</html>