首页 > 其他 > 详细

10秒后跳转

时间:2016-04-04 17:42:14      阅读:241      评论:0      收藏:0      [点我收藏+]
 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 2 <html xmlns="http://www.w3.org/1999/xhtml">
 3 <head>
 4     <title>10秒后跳转</title>
 5     <script type="text/javascript">
 6         onload = function () {
 7             //秒数每秒减1
 8             var countDown = setInterval(function () {
 9                 var second = document.getElementById("second");
10                 second.innerHTML -= 1;
11                 //秒数为0时跳转到百度
12                 if (second.innerHTML == 0) {
13                     clearInterval(countDown);
14                     location.href = "http://www.baidu.com";
15                 }
16             }, 1000);
17         }
18     </script>
19 </head>
20 <body>
21     <p>
22         页面将在<span id="second">3</span>秒后跳转
23     </p>
24 </body>
25 </html>

 

10秒后跳转

原文:http://www.cnblogs.com/Jacklovely/p/5352295.html

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