页面倒计时跳转页面效果,js倒计时效果
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
©Copyright 蕃薯耀 2017年7月18日
http://www.cnblogs.com/fanshuyao/
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="renderer" content="webkit">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>错误提示页面</title>
<link rel="icon" href="${pageContext.request.contextPath}/favicon.ico">
<style type="text/css">
.error_tip{
margin: 200px auto;
text-align: center;
}
.mt20{
margin-top: 20px;
}
.bold{
font-weight: bold;
}
.pr3{
padding-right: 3px;
}
</style>
</head>
<body>
<div class="error_tip">
<div class="bold">非法请求,请确认。</div>
<div class="mt20"><span id="timeTotal" class="pr3">5</span>秒后返回首页或<a href="${pageContext.request.contextPath}/">点击链接直接返回</a>。</div>
</div>
<script src="http://apps.bdimg.com/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript">
function gotoIndex(){
location = "${pageContext.request.contextPath}/";// 换成自己的首页地址
};
$(function(){
var timeTotalObj = $("#timeTotal");
var timeOutObj;
function timeCountdown(){
var timeValue = timeTotalObj.text();
var timeValueInt = parseInt(timeValue);
if(timeValueInt == 0){
gotoIndex();
return;
}
timeTotalObj.text(timeValueInt - 1);
timeOutObj = setTimeout(timeCountdown, 1000);
};
timeCountdown();
});
</script>
</body>
</html>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
©Copyright 蕃薯耀 2017年7月18日
http://www.cnblogs.com/fanshuyao/