将在几秒钟后返回首页!
程序员文章站
2022-05-14 09:33:37
...
1、//隔几秒自动刷新或者跳转
<meta http-equiv="refresh"content="10;url=http://www.xiaojinpiao.cn/">
2、 //倒计时自动刷新或者跳转
<div class="img">
<img src="../images/404.png" alt="页面有错误,请返回首页" title="页面有错误,请返回首页" width="30%" />
<p>将在 <span id="mes">5</span> 秒钟后返回首页!</p>
</div>
<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>