<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>T54-时间函数</title>
</head>
<body>
<input type="text " id="well" />
<button onclick="stopCount()">点击停止</button>
</body>
<script type="text/javascript">
var num= 0,i;
function timedCount(){
document.getElementById("well").value=num;
num+=1;
i=setTimeout(timedCount,1000);
}
setTimeout(timedCount,1000);
function stopCount(){
clearTimeout(i);
}
</script>
</html>