<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'SetTimeOut.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<script type="text/javascript" src="js/jquery-1.8.3.min.js"></script>
<script>
//倒计时
$(document).ready(function(){
alert("111");
getCapBtnWait();
});
var timementh;
var date=new Date();
var time=date.getTime();
function getCapBtnWait() {
var capBtn = $("#and-countdown-num");
capBtn.empty();
var d=new Date();
var countDowntime=600000-(d.getTime()-time);
if(countDowntime<=0){
capBtn.append("倒计时结束");
return;
}
var timeWaitSSS=Math.floor(countDowntime%1000/10);
var timeWaitss =Math.floor(countDowntime/1000%60);
var timeWaitmm=Math.floor(countDowntime/1000/60);
if(timeWaitmm>14){
capBtn.append("等待倒计时");
}else{
if(timeWaitmm<10){
capBtn.append("0"+timeWaitmm);
}else{
capBtn.append(timeWaitmm);
}
if(timeWaitss<10){
capBtn.append(":0"+timeWaitss);
}else{
capBtn.append(":"+timeWaitss);
}
if(timeWaitSSS<10){
capBtn.append(":0"+timeWaitSSS);
}else{
capBtn.append(":"+timeWaitSSS);
}
}
setTimeout(function() {
getCapBtnWait(capBtn);
},
10);
}
</script>
</head>
<body>
<span class="and-countdown-num" id="and-countdown-num">00:00:00</span>
</body>
</html>
jsp倒计时分秒
最新推荐文章于 2022-11-03 21:54:48 发布