zoukankan      html  css  js  c++  java
  • 简易秒表

    <!doctype html>
    <html>
    <head>
    <meta charset="utf-8">
    <meta name="author" content="智能社 - zhinengshe.com" />
    <meta name="copyright" content="智能社 - zhinengshe.com" />
    <title>智能社 - www.zhinengshe.com</title>
    
    <script>
    
    function addZero(n){
        if(n < 10){
          return "0" + n;
        } else {
          return "" + n;
        }
    }
    
    window.onload = function(){
        
        var aInput = document.getElementsByTagName("input");
        
        var timer = null;
        
        var bClick = false;//没有被点击
        var i = 0;
        // 秒转 分钟  秒
        aInput[1].onclick = function(){
    
            if(bClick == false){
                bClick =true;
                clearInterval(timer);
                timer=setInterval(function(){
                    i++;
                    aInput[0].value =addZero(parseInt(i/60))+ ":"+addZero(i%60);
                },100);
            }
        };
        
    
        aInput[aInput.length -1].onclick =function(){
            clearInterval(timer);
            bClick =false
        }
    };
    
    
    
    </script>
    </head>
    
    <body>
    
    <input type="text" value="00:00" />
    <input type="button" value="计时" />
    <input type="button" value="暂停" />
    
    </body>
    </html>

  • 相关阅读:
    Golang教程:并发介绍
    Go在windows10 64位上安装
    ElasticSearch 聚合
    ElasticSearch深入搜索
    ElasticSearch基础入门
    php安装扩展
    报错提示优化
    NK3C程序配置
    NK3C 业务权限控制
    关于测试方法
  • 原文地址:https://www.cnblogs.com/heboliufengjie/p/4478360.html
Copyright © 2011-2022 走看看