页面定时跳转(倒计时跳转)代码总结
2014-11-12 20:07
211 查看
(1)使用setTimeout函数实现定时跳转(如下代码要写在body区域内)
<script type="text/javascript"> //3秒钟之后跳转到指定的页面 setTimeout(window.location.href='http://www.phpernote.com/div-css/354.html',3); </script>
(2)html代码实现,在页面的head区域块内加上如下代码
查看代码打印 <!--5秒钟后跳转到指定的页面--><meta http-equiv="refresh" content="5;url=http://www.phpernote.com/php-function/241.html" />
(3)稍微复杂点,多见于登陆之后的定时跳转
(3)稍微复杂点,多见于登陆之后的定时跳转 查看代码打印 <html xmlns="http://www.phpernote.com/php-template/195.html"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>js定时跳转页面的方法</title></head><body><script type="text/javascript"> var t=10;//设定跳转的时间 setInterval("refer()",1000); //启动1秒定时 function refer(){ if(t==0){ location="http://www.phpernote.com/jquery-effects/207.html"; //设定跳转的链接地址 } document.getElementById('show').innerHTML=""+t+"秒后跳转到php程序员教程网"; //显示倒计时 t--; //计数器递减 } </script><span id="show"></span></body></html>
(4)利用 php header实现页面重定向已达到页面定时跳转的目地
查看代码打印 <?php /** @title:PHP实现定时跳转 @功能:等待指定的时间,然后再跳转到指定页面(代替html meta方式) */ header("refresh:3;url=http://www.phpernote.com/javascript-function/61.html"); echo '正在加载,请稍等...<br>三秒后自动跳转'; /* 说明:若等待时间为0,则与header("location:")等效。 */ ?>
相关文章推荐
- 页面定时跳转(倒计时跳转)代码总结
- 页面定时跳转(倒计时跳转)代码总结
- 页面定时跳转(倒计时跳转)代码总结
- 各种页面定时跳转(倒计时跳转)代码总结
- 页面定时跳转(倒计时跳转)代码总结
- 各种页面定时跳转(倒计时跳转)代码总结
- 页面定时跳转(倒计时跳转)代码总结
- 各种页面定时跳转(倒计时跳转)代码总结
- Javascript倒计时(定时)执行跳转事件的代码
- 使用javascript实现页面定时跳转总结篇
- Javascript 实现倒计时跳转页面代码
- splash页面定时跳转,引导页倒计时功能开发
- 页面定时跳转的js和php的代码实现和页面定时刷新
- 使用javascript实现页面定时跳转总结篇
- 10秒钟倒计时自动跳转页面代码
- ASP.NET 页面刷新和定时跳转代码整理
- js页面重定向跳转代码总结(待续)
- jsp页面跳转后台代码的方式总结~
- 页面跳转3种方法结合倒计时总结
- jsp页面自动定时跳转返回代码