<!DOCTYPE html><html><head> <meta charset="UTF-8"> <title>Document</title> <script type="text/javascript"> var time; var i=0; function c() { time=setInterval("d()",1000) } function d() { (document.getElementById('cd')).value=i++; } function f() { clearInterval(time); } </script></head><body> <input id='cd' type ="button" value ="number"> <input type ="button" value ="開始" onclick="c()"> <input type ="button" value ="停止" onclick="f()"></body></html>點了幾次開始,數字就變得快的起來。我知道這是個bug,想知道為什么會越來越快?希望各位大神說的詳細點,新手一枚,謝謝。
定時器bug問題
楊__羊羊
2018-09-13 13:10:30