1. 程式人生 > >倒計時頁面自動跳轉

倒計時頁面自動跳轉

<html> 
<head><title></title> 
<script language='javascript' type='text/javascript'> 
var secs =5; //倒計時的秒數 
var URL ; 
function Load(url){ 
URL =url; 
for(var i=secs;i>=0;i--) 

window.setTimeout('doUpdate(' + i + ')', (secs-i) * 1000); 


function doUpdate(num) 

document.getElementById('ShowDiv').innerHTML = '將在'+num+'秒後自動跳轉到 指令碼之家' ; 
if(num == 0) { window.location=URL; } 

</script> 
</head> 
<body> 
<div id="ShowDiv"></div> 
<script language="javascript"> 
Load("http://www.jb51.net"); 
</script> 
</body> 
</html>