JS 跳转页面延迟方法

方法1:

[html]  view plain copy
  1. <span style="font-size:12px;"><script type="text/javascript">     
  2. <!--     
  3. function go(t,url){     
  4. //t设置跳转时间:秒     
  5. //url设置跳转网址    
  6.   
  7.     document.write("<div id=text>本页将在<strong id='tt'></strong>后,跳转至:<span id='link'></span></div>");     
  8.     document.getElementById("link").innerHTML="<a href="+url+">"+url+"</a>";     
  9.     $(t,url);     
  10. }     
  11.     
  12. function $(t,url){     
  13. ta = t-1;  
  14. tb = t + "000";     
  15. d = document.getElementById("tt");     
  16. d.innerHTML=t;     
  17.     
  18. window.setInterval(function()     
  19.     {     
  20.         go_to(url);     
  21.     },1000);     
  22. }  
  23. function go_to(url){     
  24. d.innerHTML=ta--;     
  25. if(ta<0){     
  26. document.write("正在跳转至:<a href="+url+">"+url+"</a>");     
  27. location.href=url;     
  28. }     
  29. else{     
  30. return;     
  31. }     
  32. }     
  33. //-->     
  34. </script>    
  35.   
  36.     <script type="text/javascript">  
  37.     go(5, "/Login.aspx")     
  38. </script> </span>  

方法2:

      window.setTimeout("window.location='index.shtml'",2000);

      //两秒后跳转新页面

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值