时间倒计时提示工具,点击自动触发
<html>
<head>
<meta charset="UTF-8">
<title>证道时长倒计时</title>
<SCRIPT type="text/javascript">
var maxtime = 1 * 60; //一个小时,按秒计算,自己调整!
function CountDown() {
if (maxtime >= 0) {
msg = Math.floor(maxtime / 60);
secondsMsg = Math.floor(maxtime % 60);
if (msg == 0 ) {
document.all["divcss5"].innerHTML = "";
} else if (msg < 10) {
document.all["divcss5"].innerHTML = "0" + msg;
} else {
document.all["divcss5"].innerHTML = msg;
}
document.all["timerSeconds"].innerHTML = secondsMsg;
// if (maxtime == 5 * 60)alert("还剩5分钟");
--maxtime;
} else {
clearInterval(timer);
document.all["timerSeconds"].innerHTML = "Time's up";
}
}
timer = setInterval("CountDown()", 1000);
</SCRIPT>
<style type="text/css">
body{
background-color: blue;
text-align: center;
}
#divcss5{
position: absolute;
top: 50%;
left: 50%;
margin: -150px 0 0 -200px;
width: 400px;
height: 300px;
//border: 1px solid red;
}
#timerSeconds{
position: absolute;
top: 50%;
left: 50%;
margin: -70px 0 0 -200px;
width: 400px;
height: 300px;
//border: 1px solid red;
}
</style>
</head>
<body>
<div id="divcss5" style="color:white; font-size: 70"></div>
<span> </span>
<div id="timerSeconds" style="color:white; font-size: 70"></div>
</body>
</html>