9.时间函数01
2017-04-13 16:18 笨笨03 阅读(163) 评论(0) 编辑 收藏 举报<!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>