404页面自动跳转
2015-09-02 13:52
337 查看
可以自动跳转到首页,也可以跳转到特定的链接。
效果如图所示:
<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>
效果如图所示:
相关文章推荐
- ashx页面缓存
- linux中的fork()函数以及标准I/O缓冲
- 让Web API支持Protocol Buffers
- ibatis学习——SqlMapConfig和SqlMap
- 《算法导论》第18章 B树
- Android HAL实例解析
- expdp/impdp 的network_link参数,实现远程导入导出
- Android Studio中使用AIDL以及couldn't find import for class问题的处理
- android基础篇(二),Service及IntentService
- js模板引擎介绍搜集
- 数字组合
- 程序员什么时候该考虑辞职
- sed的使用
- Xml,Json,Hessian,Protocol Buffers序列化对比
- ViewController详解
- hihoCoder 1224 赛车 (dfs,邻接链表存边)
- Java与JavaScript
- iOS时间格式转换总结
- 配置IP地址
- Java 链接SQL Server 的代码片