首页 > Web开发 > 详细

js 秒表计时器(开始,停止,清零)

时间:2019-11-23 10:14:03      阅读:396      评论:0      收藏:0      [点我收藏+]

<html>

<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)
    
 }
function cs()
{
 
     c=0  
     document.getElementById(‘txt‘).value= 0
     
}
 
</script>
</head>

<body>
<form>
<input type="button" value="开始!"  id="start" onClick="timedCount()">
<input type="text" id="txt">
<input type="button" value="停止!" id="end" onClick="stopCount()">
<input type="button" value="清零!" id="ss" onClick="cs()">
</form>
</body>

</html>

js 秒表计时器(开始,停止,清零)

原文:https://www.cnblogs.com/0826sw/p/11915283.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!