点击start和stop都没有反应,是什么原因?
<!DOCTYPE HTML>
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>计时器计数</title>
<script type="text/javascript">
var num = 0;
var i;
function starcount(){
document.getElementById("txt").value = num;
num = num + 1;
i=setTimeout("starcount()",1000);
}
//setTimeout("starcount()",1000);
function stopcount(){
clearTimeout(i);
}
</script>
</head>
<body>
<form>
<input type="text" id="txt" />
<input type="button" value="start" onclick="startcount()" />
<input type="button" value="stop" onclick="stopcount()" />
</form>
</body>
</html>