您好,欢迎来到匠吉游戏。
搜索
您的当前位置:首页网站404页面3秒后跳到首页的实例代码_javascript技巧

网站404页面3秒后跳到首页的实例代码_javascript技巧

来源:匠吉游戏


代码如下:




404 Not Found


找不到指定的页面


3秒后自动返回


var second = document.getElementById('totalSecond').textContent;
if (navigator.appName.indexOf("Explorer") > -1) //判断是IE浏览器还是Firefox浏览器,采用相应措施取得秒数
{
second = document.getElementById('totalSecond').innerText;
} else
{
second = document.getElementById('totalSecond').textContent;
}
setInterval("redirect()", 1000); //每1秒钟调用redirect()方法一次
function redirect()
{
if (second < 0)
{
location.href = 'http://要跳转的网站';
} else
{
if (navigator.appName.indexOf("Explorer") > -1)
{
document.getElementById('totalSecond').innerText = second--;
} else
{
document.getElementById('totalSecond').textContent = second--;
}
}
}
-->




Copyright © 2019- jianjh.net 版权所有

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务