(1)使用setTimeout函数实现定时跳转(以下代码要写在body区域内) 1 <script type="text/javascript"> 2 //3秒钟以后跳转到指定的页面 3 setTimeout(window.location.href='www.baidu.com',3); 4 </script> (2)html代码实现,在页面的head区域块内加上以下代码 1 <!--5秒钟后跳转到指定的页面--> 2 <meta http-equiv="refresh" content="5;url=http://www.baidu.com" /> (3)稍微复杂点,多见于登录以后的定时跳转 01 <html xmlns=""> 02 <head> 03 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 04 <title>js定时跳转页面的方法</title> 05 </head> 06 <body> 07 <script type="text/javascript"> 08 var t=10;//设定跳转的时间 09 setInterval("refer()",1000); //启动1秒定时 10 function refer(){ 11 if(t==0){ 12 location="http://www.baidu.com"; //#设定跳转的连接地址 13 } 14 document.getElementById('show').innerHTML=""+t+"秒后跳转到php程序员教程网"; // 显示倒计时 15 t--; // 计数器递减 16 //本文转自: 17 } 18 </script> 19 <span id="show"></span> 20 </body> 21 </html>