在只用js之前,一定要引入jar包
<script src="../js/jquery-1.4.2.js" type="text/javascript"></script>
<div id="one"> 0 </div> <script type="text/javascript"> var one = document.getElementById("one"); var i = 0; var dt = setInterval(function(){ one.innerText=i; i++; }, 100); function stop(){ clearInterval(dt); } function star(){ dt = setInterval(function(){ one.innerText=i; i++; }, 100); } </script> <input type="button" onclick="stop()" value="停止"/> <input type="button" onclick="star()" value="开始"/>
原文地址:https://www.cnblogs.com/0710whh/p/9331000.html
时间: 2024-10-13 17:19:51