首页 > Web开发 > 详细

js定时器案例

时间:2016-11-03 19:23:25      阅读:267      评论:0      收藏:0      [点我收藏+]
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>定时器案例</title>
    <script>
        var myCount = 5;
        function count() {
            document.getElementById("test").innerText = myCount+"秒后隐藏";
            myCount--;
            if (myCount == 0) {
                document.getElementById("test").innerHTML = "已经隐藏";
                document.getElementById("tcdiv").style.display="none";
                return;
            }
            setTimeout("count()", 1000);
        }
</script>
</head>
<body onLoad="setTimeout(‘count()‘,10);">
    <form id="form1" runat="server">
    
       <div id="test"></div>
       <div id="tcdiv" style="width:200px; height:100px; border: thin solid #ccc">
       
       </div>
    </form>
</body>
</html>


本文出自 “10975329” 博客,请务必保留此出处http://10985329.blog.51cto.com/10975329/1868878

js定时器案例

原文:http://10985329.blog.51cto.com/10975329/1868878

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