标签:style io ar color sp java on bs cti
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>time</title>
<script src="jquery.js" type="text/javascript"></script>
</head>
<body>
<h1>
<span id="loan_time">0 天 0 小时 0 分 0 秒</span>
<input id="hid" type="hidden" value="75255" />
</h1>
<script>
$(function(){
setLeftTime();
});
function showSeconds() {
var day1 = Math.floor(seconds / (60 * 60 * 24));
var hour = Math.floor((seconds - day1 * 24 * 60 * 60) / 3600);
var minute = Math.floor((seconds - day1 * 24 * 60 * 60 - hour * 3600) / 60);
var second = Math.floor(seconds - day1 * 24 * 60 * 60 - hour * 3600 - minute * 60);
if (day1 < 0) {
clearInterval(timer);
$("#loan_time").html("已经结束!");
} else {
$("#loan_time").html(day1 + " 天 " + hour + " 小时 " + minute + " 分 " + second + " 秒");
}
seconds--;
}
function setLeftTime() {
seconds = parseInt($("#hid").val(), 10);
timer = setInterval(showSeconds,1000);
}
</script>
</body>
</html>
JS_简单倒计时_实例_格式:0 天 20 小时 48 分 54 秒
标签:style io ar color sp java on bs cti
原文地址:http://my.oschina.net/miaowang/blog/355334