源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

JS 页面计时器示例代码

  • 时间:2021-05-22 06:22 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:JS 页面计时器示例代码
[u]复制代码[/u] 代码如下:
<html> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <head> <script type="text/javascript"> var c=0 var t function timedCount() { document.getElementById('txt').value=c c=c+1 t=setTimeout("timedCount()",1000) } function stopCount() { clearTimeout(t) } </script> </head> <body> <form> <input type="button" value="开始计时!" onClick="timedCount()"> <input type="text" id="txt"> <input type="button" value="停止计时!" onClick="stopCount()"> </form> <p>请点击上面的“开始计时”按钮来启动计时器。输入框会一直进行计时,从 0 开始。点击“停止计时”按钮可以终止计时。</p> <p>timedCount(),1000ms自己调自己。</p> </body> </html>
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部