秒表js开始结束

qq:2579679536


<html>
    <head>
        <meta charset="UTF-8">
        <meta name="Generator" content="EditPlus®">
        <meta name="Author" content="">
        <meta name="Keywords" content="">
        <meta name="Description" content="">
        <title>Documenttitle>
     head>
     <body>
        <div id="num">0div>
        <input type="submit" name="" id="start" value="开始" />
        <input type="submit" name="" id="stop" value="结束" />
         <script type="text/javascript">



            num=document.getElementById('num');


            start=document.getElementById('start');
            stop=document.getElementById('stop');
            num.innerHTML=0;
            ta=1;
            start.οnclick=function()
            {
                if(!ta)
                {
                    num.innerHTML=0;
                }
                //t=setTimeout(newnum,1000);
                t=setInterval(newnum,1000);
                this.disabled=true;
                stop.disabled=false;
                //alert(1);
            }
            stop.οnclick=function()
            {
                //clearTimeout(t);
                clearInterval(t);
                this.disabled=true;
                start.disabled=false;
                ta=0;
            }
            function newnum()
            {
                num.innerHTML=parseInt(num.innerHTML)+1;
                    //t=setTimeout(newnum,1000);
            }


         script>
     body>
html>

你可能感兴趣的:(jquery)