各种页⾯定时跳转(倒计时跳转)代码总结⼀、使⽤setTimeout函数实现定时跳转(如下代码要写在body区域内)
<script type="text/javascript">
//3秒钟之后跳转到指定的页⾯
  setTimeout(window.location.href='www.baidu',3);
</script>
  或者:
  <script language="JavaScript" type="text/javascript">
function Redirect(){
window.location = "add.jsp";  //要跳转的页⾯
}
setTimeout('Redirect()', 3000);      //第⼆个参数是时间,单位毫秒
</script>
⼆、html代码实现,在页⾯的head区域块内加上如下代码
<!--5秒钟后跳转到指定的页⾯-->
<meta http-equiv="refresh" content="5;url=www.baidu" />
三、使⽤脚本语⾔(就⼀句简单)
<%response.setHeader("Refresh","3;url=index.jsp");%>
四、稍微复杂点,多见于登陆之后的定时跳转()
  ⽅法⼀:
<!doctype html>
<head>
<meta charset=utf-8" />
<title>js定时跳转页⾯的⽅法</title>
</head>
<body>
<script>
  var t=10;//设定跳转的时间
  setInterval("refer()",1000); //启动1秒定时
  function refer(){
    if(t==0){
      location="www.baidu"; //#设定跳转的链接地址
    }
    ElementById('show').innerHTML=""+t+"秒后跳转到百度"; // 显⽰倒计时
    t--; // 计数器递减
    //本⽂转⾃:
  }
</script>
<span id="show"></span>
</body>
</html>
  ⽅法⼆:
<%@ page language="java"  import="java.util.*"  contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "/TR/html4/loose.dtd">
<html>
<head>
<!-- 完成页⾯定时的跳转 -->
<meta http-equiv="refresh" content="5;url=/Web_01/main.html">
<title>Insert title here</title>
</head>
<body onload="run()">
页⾯将在<span id="spanId">5</span>秒后跳转!!
</body>
<br>
<script type="text/javascript">
/html代码转链接
/ 页⾯⼀加载完成,该⽅法就会执⾏
// 读秒,⼀秒钟数字改变⼀次
var x = 5;
function run(){
// 获取到的是span标签的对象
var span = ElementById("spanId");
// 获取span标签中间的⽂本
span.innerHTML = x;
x--;
// 再让run⽅法执⾏呢,⼀秒钟执⾏⼀次
window.setTimeout("run()", 1000);
}
</script>
</html>
  ⽅法三:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title></title>
<script type="text/javascript">
  function countDown(secs,surl){
    var jumpTo = ElementById('jumpTo');
    jumpTo.innerHTML=secs;
    if(--secs>0){
    setTimeout("countDown("+secs+",'"+surl+"')",1000);
  }
    else{
    location.href=surl;
  -ma
  }
  }
</script>
</head>
<body>
<h1>提交成功</h1>
<a href="www.so"><span id="jumpTo">3</span>秒后系统会⾃动跳转,也可点击本处直接跳</a> <script type="text/javascript">
countDown(3,'www.so/');
</script>
</body>
</html>