<input id="button1" type="button" value="开始" > <input id="button2" type="button" value="关闭" > <script> window.onload = function () { var btn1 = document.getElementById("button1"); var btn2 = document.getElementById("button2"); // btn1.οnclick= setInt(showInfo, 1000); var timer = null; btn1.onclick = function () { timer = setInterval(showInfo, 1000); } btn2.onclick= function () { clearInterval(timer); } }; </script>
js 定时器应用
最新推荐文章于 2025-03-31 18:16:26 发布