這個(gè)為啥也停不下來
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>計(jì)時(shí)器</title>
<script type="text/javascript">
? var num=0;
? var i;
? function startCount(){
? ? document.getElementById('count').value=num;
? ? num=num+1;
? ? i=setTimeout("startCount()",5000);
? }
? ? ?// setTimeout("startCount(),1000");
? function stopCount(){
? ?clearTimeout(i);
? }
</script>
</head>
<body>
? <form>
? ? <input type="text" id="count" />
? ? <input type="button" value="Start" onClick="startCount()" />
? ? <input type="button" value="Stop" onClick="stopCount()" ?/>
? </form>
</body>
</html>
2017-08-02
測試過了,可以停。
2017-08-02
可以停下來的啊,你這個(gè)是五秒中增加一個(gè)數(shù),你再仔細(xì)看看。你把一秒增加一個(gè)的注釋掉了