数字递减(5秒钟跳转页面)

 
<script type="text/javascript" >         window.onload = function () {             //定义这个setTimeout 就是1秒执行一次!             setTimeout(Change, 1000);         };         function Change() {             var time = document.getElementById("time").innerHTML;             time = parseInt(time);             time--;             if (time<1) {                 var url = document.getElementById("url").href;                 window.location.href = url;             } else {                 document.getElementById("time").innerHTML = time;                 setTimeout(Change, 1000);             }         }     </script>
</head>
<body>    <span style="font-size:28px;color: #ff0000" id="time">5</span><a id="url" href="Default.aspx"></a>
</body>
</html>
posted @ 2014-04-01 15:51  crazyair  阅读(244)  评论(0编辑  收藏  举报