<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>简单的倒计时跳转页面</title>
</head>
<body>
<p><span id="time">5</span>秒后跳转到百度</p>
<script type="text/javascript">
var time = 5; //定义跳转的秒数
setInterval(function () { //执行计时器方法
time--; //计时器开始,对定义的秒数进行递减
document.getElementById("time").innerHTML = time; //改变id=time的html等于time的值
if (time == 0) { //判断当time的值等于0时
location.href = "http://baidu.com"; //即跳转到网址:http://baidu.com
};
}, 1000);
</script>
</body>
</html>