1. 程式人生 > >js幾秒以後倒計時跳轉示例

js幾秒以後倒計時跳轉示例

 
<html> 
<head> 
<title>出錯啦~~~</title> 
<link href="css/login1.css" mce_href="css/login1.css" rel="stylesheet" type="text/css" /> 
<script language="javascript" type="text/javascript"> 
var i = 5; 
var intervalid; 
intervalid = setInterval("fun()", 1000); 
function fun() { 
if (i == 0) { 
window.location.href = "../index.html"; 
clearInterval(intervalid); 

document.getElementById("mes").innerHTML = i; 
i--; 

</script> 
</head> 
<body> 
<div id="errorfrm"> 
<h3>出錯啦~~~</h3> 
<div id="error"> 
<img src="images/error.gif" mce_src="images/error.gif" alt="" /> 
 系統出錯,請聯絡管理員!  
 將在 <span id="mes">5</span> 秒鐘後返回首頁!  
</div> 


</div> 
</body> 
</html>