求大神帮我看看这个代码出什么问题了(添加stop和start按钮控制计时开始和结束)
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>定时器</title>
<script type="text/javascript">
var attime;
function clock(){
var time=new Date();
attime=time.getHours()+":"+time.getMinutes()+":"+time.getSeconds() ;
document.getElementById("clock").value = attime;
}
function startclock(){
var i=setInterval("clock()",1000);
}
function stopclock(){
clearInterval(i);
}
</script>
</head>
<body>
<form>
<input type="text" id="clock" size="50" />
<input type="button" id="start" value="start" onclick="startclock()" />
<input type="button" id="stop" value="stop" onclick="stopclock()"/>
</form>
</body>
</html>
start可以开始但是stop停止不了为啥啊--