今天的第三个坑

  http://boleyn.iteye.com/blog/1144015

 

 

 

 

<html>
    <head>
        <title> timer_test </title>
        <meta charset="utf-8">
        <script type="text/javascript">

            function timeout()
            {

            function conf1()
              {
                if (confirm("要取消吗")==true)
                {
                  clearInterval(t);
                }
                else
                {
                  console.log("have not cancel!");
                }
              }
            // var t=setInterval("conf1()",2000);  // 出错咯
            var t=setInterval(conf1,2000);
            }
        </script>
    </head>
    <body>
      <input type="button" value="click me " onclick="timeout()">
    </body>
</html>

 

posted @ 2016-06-14 23:18  Tachi  阅读(131)  评论(0编辑  收藏  举报