问答详情
源自:8-4 取消计时器clearInterval()

停止后 怎样再次点击按钮继续运行呢

<input type="button" value="点击暂停" onclick="clearInterval(i)" />

提问者:慕码人5044430 2020-05-09 13:23

个回答

  • 黑夜的白_羊
    2020-06-08 22:42:50

    <!DOCTYPE HTML>

    <html>

        <head>

            <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

            <title>计时器</title>

            <script type="text/javascript">

               function clock(){

                     var time=new Date();

                     document.getElementById("clock").value = time;

               }

               var i;

               function start() {   

                 i = setInterval("clock()",100);

               }

               i=setInterval("clock()",100);

            </script>

        </head>

        <body>

          <form>

              <input type="text" id="clock" size="50"  />

              <input type="button" value="Stop" onclick="clearInterval(i)" />

              <input type="button" value="Start" onclick="start()" />

              

          </form>

        </body>

    </html>


  • 慕斯卡9592173
    2020-05-31 10:23:12

    ,,,,

  • 慕斯卡9592173
    2020-05-31 10:22:51

    ,,,,,,