404页面自动跳转

可以自动跳转到首页,也可以跳转到特定的链接。


<script language=javascript>
function countDown(secs,surl){
if(--secs>0){
      setTimeout("countDown("+secs+",'"+'http://baidu.com'+surl+"')",1000);
      }
else{ 
      location.href="http://baidu.com";
    } 
}
</script>


<%@ page contentType="text/html; charset=utf-8" language="java"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title></title>

     
<style type="text/css">
<!--

body{background: url(http://img.test.com/news/image/news/background.gif) repeat;font:12px "ËÎÌå", Arial;color:#333;margin:0;padding:0;}
div{margin:0;padding:0;border:0;}


.main0816{width:371px;margin:0 auto;margin-top:47px;}
.main0816 .logo{width:371px;height:67px;text-align:center;}
.mainbox{width:371px;margin:0 auto;}
.mainbox .title{width:371px;height:17px;background:url(http://img.test.com/news/image/news/boxtop.gif) no-repeat;}
.mainbox .content{width:365px;margin:0 auto;height:75px;padding-top:40px;border:1px solid #ccc;border-top:0px;background:#fff;}
.mainbox .content .text{width:280px;margin:0 auto;height:32px;line-height:32px;background:url(http://img.test.com/news/image/news/boxicon.gif) no-repeat;padding-left:50px;font-size:14px;font-weight:bold;}
-->
</style>
</head>
<script language=javascript>
function countDown(secs,surl){
if(--secs>0){
      setTimeout("countDown("+secs+",'"+surl+"')",1000);
      }
else{ 
      location.href=surl;
    } 
}
</script>

<body>
<div class="main0816">
	<div class="logo"><img src="http://js.test.com/homepage/logo/logo138x50.png" alt="" /></div>
	<div class="mainbox">
		<div class="title"></div>
		<div class="content">
			<div class="text">页面没有找到,3秒钟之后带您进入首页</div>
		</div>
	</div>
</div>
<script language=javascript>countDown(4,'/');</script>
</html>

效果如图所示:


转载于:https://www.cnblogs.com/jeofey/p/7227035.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值