<script type="text/javascript" src="/inc/jquery-1.2.6.min.js"></script><script type="text/javascript">
var t= 5;//跳转所需时间(秒)
$(function(){ redict();//5秒后页面跳转回主页});
function redict(){ $("#showTime").html(t); var id = window.setInterval("setTime()",1000);//setInterval方法中不能调用带参数的方法,而且调用方法必须使用双引号包含,否则无效。}
function setTime(){ t=t-1; $("#showTime").html(t); if(t==0) { $("#redictTip").html('页面跳转中...'); window.location="main.aspx"; }}
</script>
html源码中加上如下代码以作提示:
<div id="redictTip" style="margin-top:50px; font-size:16px; color:Red; text-align:center;">请求的页面不存在,经过<span id="showTime"></span>秒后自动跳转回主页</div>