404跳转页面5秒倒计时页面跳转

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jquery和JavaScript404跳转页面5秒倒计时页面跳转</title>
<meta name="description" content="jQuery和JavaScript两个版本的404跳转页面效果,利用倒计时间控制页面在规定多少秒时间内,页面跳转到指定的页面跳转过程。" />
<style type="text/css">
html{background:url(images/paper.jpg)!important;}
a,fieldset,img{border:0;}
a{color:#221919;text-decoration:none;outline:none;}
a:hover{color:#3366cc;text-decoration:underline;}
body{font-size:24px;color:#B7AEB4;}
body a.link,body h1,body p{-webkit-transition:opacity 0.5s ease-in-out;-moz-transition:opacity 0.5s ease-in-out;transition:opacity 0.5s ease-in-out;}
#wrapper{text-align:center;margin:100px auto;width:594px;}
a.link{text-shadow:0px 1px 2px white;font-weight:600;color:#3366cc;opacity:0;}
h1{text-shadow:0px 1px 2px white;font-size:24px;opacity:0;}
img{-webkit-transition:opacity 1s ease-in-out;-moz-transition:opacity 1s ease-in-out;transition:opacity 1s ease-in-out;height:202px;width:199px;opacity:0;}
p{text-shadow:0px 1px 2px white;font-weight:normal;font-weight:200;opacity:0;}
.fade{opacity:1;}
@media only screen and (min-device-width:320px) and (max-device-width:480px){
	#wrapper{margin:40px auto;text-align:center;width:280px;}
}
</style>
<strong><script type="text/javascript" src="js/jquery-1.4.2.min.js"></script></strong>
<!--解决 IE6 背景缓存-->
<!--[if IE 6]><script type="text/javascript">document.execCommand("BackgroundImageCache", false, true);</script><![endif]-->
<script type="text/javascript">
$(document).ready(function(){
	if (!$.browser.msie){
		$("img").addClass('fade').<strong>delay(800)</strong>.queue(function(next){
			$("h1, p").addClass("fade");
			$("a.link").css("opacity", 1);
			next();
		});
	}else{
		$("img, h1, p").addClass('fade');
		$('a.link').css('opacity', 1);
	}
});
</script>
</head>

<body>


    <div id="wrapper">
        <a href="http://www.baidu.com"><img src="images/404_icon.png"></a>
        <div>
            <h1>唉呀!</h1>
            <p>你正在寻找的页面无法找到。<a style="color:#ff6600;" href="http://www.17sucai.com/">可能在这里!</a></p>
            <a class="link" href="/" οnclick="history.go(-1)"><span id="sec">5</span> 秒后返回首页</a>
			<br /><br /><br />
        </div>
    </div>
	
	<script type="text/javascript">
	$(function () {            
	   setTimeout("lazyGo();", 1000);  //在一秒之后执行lozyG0()这函数
	});
	function lazyGo() {
		var sec = $("#sec").text();
		$("#sec").text(--sec);     //text()设置或返回被选元素的文本内容。
		if (sec > 0)
			setTimeout("lazyGo();", 1000);
		else
			window.location.href = "http://www.baidu.com";
	}
	</script>

	
</body>
</html>
</pre><pre>

注意:测试效果的时候要链接  jquery-1.4.2.min.js
相关知识讲解:
 setTimeout("lazyGo();", 1000);  //在一秒之后执行lozyG0()这函数
 text()设置或返回被选元素的文本内容。
 delay() 方法对队列中的下一项的执行设置延迟。
queue() 方法显示或操作在匹配元素上执行的函数队列
<addClass() 方法向被选元素添加一个或多个类
css() 方法设置或返回被选元素的一个或多个样式属性。
next() 获得匹配元素集合中每个元素紧邻的同胞元素。如果提供选择器,则取回匹配该选择器的下一个同胞元素。
css3属性:opacity  :设置 div 元素的不透明级别 ,默认为1


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值