<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Error</title>
<meta charset="utf-8" />
<script>
onload = function () {
setTimeout(change, 1000);
}
function change() {
var time = document.getElementById('time').innerHTML;
time = parseInt(time);
time--;
if (time<=0) {
location.href = "http://www.baidu.com";
}
document.getElementById('time').innerHTML = time;
setTimeout(change, 1000);//用setTimeout()实现setInterval()
}
</script>
</head>
<body>
服务器忙啊!<span style="font-size:20px;color:red" id="time">5</span>秒钟以后自动跳转到百度<a href="http://www.baidu.com">百度</a>
</body>
</html>