码迷,mamicode.com
首页 > 其他好文 > 详细

5S后返回首页

时间:2017-08-08 20:02:06      阅读:143      评论:0      收藏:0      [点我收藏+]

标签:int   color   javascrip   char   element   主页   doc   window   bsp   

 1 <!DOCTYPE html>
 2 <html>
 3  <head>
 4   <title>5S后返回首页</title>  
 5   <meta http-equiv="Content-Type" content="text/html; charset=gkb"/>   
 6  </head>
 7  <body>
 8   <h2>操作成功</h2>
 9   <p><a id="showtime">5s后回到主页</a> <a href="window.history.back()">返回</a></p>
10   
11  
12   <script type="text/javascript">  
13  
14    //通过window的location和history对象来控制网页的跳转。
15         var flag = 5;
16 
17     var timer = setInterval(function(){
18 
19         document.getElementById("showtime").innerHTML=flag+"秒后自动跳转到主页";
20 
21         flag=flag-1;
22 
23         if(flag<=0){
24 
25          window.location.href="";
26 
27         }
28 
29     },1000);   
30   
31  </script> 
32 </body>
33 </html>

 

5S后返回首页

标签:int   color   javascrip   char   element   主页   doc   window   bsp   

原文地址:http://www.cnblogs.com/calamus/p/7308209.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!