<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> js倒计时</TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>
<BODY>
<TABLE>
<TR>
<TD>剩余时间</TD>
</TR>
<TR>
<TD>
<div id="time_1"></div>
<script type="text/javascript">
var left_1 = 360; // 剩余时间,秒为单位
setTime_1();
function setTime_1() {
if (left_1) {
left_1 --;
var hour = Math.floor(left_1 / 3600);
hour = (hour < 10) ? ('0' + hour) : hour;
var minute = Math.floor((left_1 % 3600) / 60);
minute = (minute < 10) ? ('0' + minute) : minute;
var second = (left_1 % 3600) % 60;
second = (second < 10) ? ('0' + second) : second;
var time = document.getElementById('time_1');
time.innerHTML = '还剩<span>' + hour + '</span>小时<span>' + minute + '</span>分<span >' + second + '</span>秒';
} else {
var time = document.getElementById('time_1');
time.innerHTML = '超出购买时间';
}
}
window.setInterval(setTime_1, 1000);
</script>
</TD>
</TR>
<TR>
<TD>
<div id="time_2"></div>
<script type="text/javascript">
var left_2 = 720; // 剩余时间,秒为单位
setTime_2();
function setTime_2() {
if (left_2) {
left_2 --;
var hour = Math.floor(left_2 / 3600);
hour = (hour < 10) ? ('0' + hour) : hour;
var minute = Math.floor((left_2 % 3600) / 60);
minute = (minute < 10) ? ('0' + minute) : minute;
var second = (left_2 % 3600) % 60;
second = (second < 10) ? ('0' + second) : second;
var time = document.getElementById('time_2');
time.innerHTML = '还剩<span>' + hour + '</span>小时<span>' + minute + '</span>分<span >' + second + '</span>秒';
} else {
var time = document.getElementById('time_2');
time.innerHTML = '超出购买时间';
}
}
window.setInterval(setTime_2, 1000);
</script>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>