The original Published time: 2008-10-11--from my Baidu article [imported by moving tools]
<title> Show Time </title>
<script language= "JavaScript" >
t =-1; Counter
SetInterval ("Testtime ()", 1000); Start the 1-second timer
function Testtime () {
if (t<0) return; The counter value is less than 0, indicating that the countdown has not started
if (t = = 0)//Counter value is 0, turn
Location = "Http://www.baidu.com";
view.innerhtml = "<b>" +t+ "</b>"; Show Countdown
t--; Counter Decrement
}
function Offtime () {
if (Event.srcElement.value! = "Click to start") {//If the countdown is not started
t =-1; Initial counter
view.innerhtml = ""; Empty Countdown
}
}
Document.onclick = Offtime; Start Click event Monitoring
</script>
<body>
<input Type=button value= "Click to start" onclick= "t=5" >
<br></br>
<a href= ' http://www.baidu.com ' > if the browser does not jump, click here </a>
<span id= "View" ></span>
</body>
---------------------------
<title> Show Time </title>
<script language= "JavaScript" >
SetInterval ("Testtime ()", 1000); Start the 1-second timer
function Testtime () {
if (t<0) return; The counter value is less than 0, indicating that the countdown has not started
if (t = = 0)//Counter value is 0, turn
Location = "Http://www.baidu.com";
view.innerhtml = "<b>" +t+ "</b>"; Show Countdown
t--; Counter Decrement
}
Document.onload = Testtime (); Start Click event Monitoring
</script>
<body onload= "T=5" >
<span id= "View" ></span>
<br></br>
<a href= ' http://www.baidu.com ' > if the browser does not jump, click here </a>
</body>
Countdown browser Jump JavaScript