jQuery倒计时跳转实例代码
1,jquery倒计时跳转实现代码:
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>跳转页面</title>
<script src="jquery.js"></script>
<script language="javascript"><!--
$(document).ready(function() {
function jump(count) {
window.setTimeout(function(){
count--;
if(count > 0) {
$('#num').attr('innerHTML', count);
jump(count);
} else {
location.href="http://jbxue.com";
}
}, 1000);
}
jump(3);
});
// --></script>
</head>
<body>
<span style="color:red">欢迎来到jbxue.com!</span><br/>jbxue.com页面将在3秒后跳转...<br/>还剩<span id="num">3</span>秒
</body>
</html>
可以复制代码并保存到文件中,直接用浏览打开测试效果,注意引入jquery.js文件。
附,js几秒以后倒计时跳转代码
使用js实现几秒以后倒计时跳转。
<html>
<head>
<title>倒计时跳转代码--www.jbxue.com</title>
<link href="css/login1.css" mce_href="css/login1.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript">
var i = 5;
var intervalid;
intervalid = setInterval("fun()", 1000);
function fun() {
if (i == 0) {
window.location.href = "../index.html";
clearInterval(intervalid);
}
document.getElementById("mes").innerHTML = i;
i--;
}
</script>
</head>
<body>
<div id="errorfrm">
<h3>出错啦~~~</h3>
<div id="error">
<img src="images/error.gif" mce_src="images/error.gif" alt="" />
<p>系统出错,请联系管理员!</p>
<p>将在 <span id="mes">5</span> 秒钟后返回首页!</p>
</div>
</div>
</body>
</html>
您可能感兴趣的文章:
javascript倒计时(setTimeout)的示例代码
jQuery倒计时跳转实例代码
js 3秒后跳转页面实例代码
js 控制页面跳转的五种方法
60秒倒计时的jquery实现代码
js 倒计时多少秒后跳转页面的实例代码
jquery倒计时弹出时间到了提示
js倒计时与N秒后跳转页面的代码
jquery 倒计时效果实现秒杀的思路与代码
jQuery倒计时代码(图文)