5秒后自动跳转的错误页面代码
2018-02-22 16:03
260 查看
新建一个Error.html页面
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
</head>
<body>
出现异常了,5秒以后自动跳转到首页。
<span id="totalSecond">5</span>
<script type="text/javascript">
var second = document.getElementById('totalSecond').textContent;
if (navigator.appName.indexOf("Explorer") > -1) {
second = document.getElementById('totalSecond').innerText;
} else {
second = document.getElementById('totalSecond').textContent;
}
setInterval("redirect()", 1000);
function redirect() {
if (second < 0) {
location.href = '/Home/Index';
} else {
if (navigator.appName.indexOf("Explorer") > -1) {
document.getElementById('totalSecond').innerText = second--;
} else {
document.getElementById('totalSecond').textContent = second--;
}
}
}
</script>
</body>
</html>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
</head>
<body>
出现异常了,5秒以后自动跳转到首页。
<span id="totalSecond">5</span>
<script type="text/javascript">
var second = document.getElementById('totalSecond').textContent;
if (navigator.appName.indexOf("Explorer") > -1) {
second = document.getElementById('totalSecond').innerText;
} else {
second = document.getElementById('totalSecond').textContent;
}
setInterval("redirect()", 1000);
function redirect() {
if (second < 0) {
location.href = '/Home/Index';
} else {
if (navigator.appName.indexOf("Explorer") > -1) {
document.getElementById('totalSecond').innerText = second--;
} else {
document.getElementById('totalSecond').textContent = second--;
}
}
}
</script>
</body>
</html>
相关文章推荐
- 等待指定时间后自动跳转或关闭当前页面的js代码
- 5秒后js控制页面自动跳转的功能
- 中英文页面自动跳转代码
- 自动延时跳转到指定页面JS脚本代码
- AngularJS实现页面跳转后自动弹出对话框实例代码
- html网页自动跳转页面代码
- JS判断设备是否是移动端自动跳转到对应页面的简单代码
- 5秒后跳转到另一个页面的js代码
- 页面自动更新跳转的代码
- 页面自动刷新和自动跳转代码
- 一种基于自定义代码的asp.net网站首页根据IP自动跳转指定页面的方法!
- wap浏览自动跳转到wap页面的js代码
- 10秒钟倒计时自动跳转页面代码
- jquery 5秒后自动跳转页面
- 一些页面自动跳转的实现 (功能:5秒后,自动跳转到同目录下的02view.html文件)
- javascript实现页面自动刷新和自动跳转代码
- 一种基于自定义代码的asp.net网站首页根据IP自动跳转指定页面的方法!
- 分享个打开a页面自动跳转到b页面的HTML代码
- 在登录系统时,一块文本区域显示系统将在多少秒自动跳转到某个页面代码
- 自动判断浏览器的中英文版本自动跳转网站中英文页面代码