剩余时间 <span class="djtime"><i id="t_h"></i><span>:</span><i id="t_m"></i><span>:</span><i id="t_s"></i></span></span>
<script type="text/javascript">
function getRTime() {
var EndTime= new Date('2017/8/30 18:00:00'); //截止时间
var NowTime = new Date();
var t = EndTime.getTime() - NowTime.getTime();
var h = Math.floor(t / 1000 / 60 / 60 % 24);
var m = Math.floor(t / 1000 / 60 % 60);
var s = Math.floor(t / 1000 % 60);
console.log(s)
if (h < 10) {
document.getElementById("t_h").innerHTML = "0" + h;
} else {
document.getElementById("t_h").innerHTML = h;
}
if (m < 10) {
document.getElementById("t_m").innerHTML = "0" + m;
} else {
document.getElementById("t_m").innerHTML = m;
}
if (s < 10) {
document.getElementById("t_s").innerHTML = "0" + s;
} else {
document.getElementById("t_s").innerHTML = s;
}
}
setInterval(getRTime, 1000);
</script>