62,267
社区成员
发帖
与我相关
我的任务
分享<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
$(function() {
var decreasement = function() {
if (count > 0) {
$("#msg").html("<h1>" + count + "</h1>");
count --;
setTimeout(decreasement, 1000);
}
else {
// 跳转
}
};
decreasement();
});
</script>
</head>
<body>
<div id="msg"></div>
</body>
</html><span id="id"></span>
<script type="text/javascript">
var json = {'info':'注册成功,5秒后跳转......'};
var number = json["info"].match(/\d+/);
var Timer;
function ResponseRedirect(){
document.getElementById("id").innerHTML=number;
number--;
if(number==0){
clearTimeout(Timer);
window.location.href="http://www.baidu.com";
}
else
Timer = setTimeout(ResponseRedirect,"1000");
}
ResponseRedirect();
</script>