<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<script>
function timer(){
var time=document.getElementById("second").innerHTML;
if(time>1){
document.getElementById("second").innerHTML=time-1;
}else{
location.href="http://www.baidu.com";
}
}
</script>
<body οnlοad=" setInterval('timer()',1000)">
<p><span id="second" style="color:red;">5</span>秒后跳转到百度</p>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<script>
function timer(){
var time=document.getElementById("second").innerHTML;
if(time>1){
document.getElementById("second").innerHTML=time-1;
}else{
location.href="http://www.baidu.com";
}
}
</script>
<body οnlοad=" setInterval('timer()',1000)">
<p><span id="second" style="color:red;">5</span>秒后跳转到百度</p>
</body>
</html>