<!--倒计时-->
window.onload = clock;
function clock() {
var timestamp = $("#shijiancuo").attr("title");
var stop = new Date(timestamp * 1000);
var today = new Date();
var shenyu = stop.getTime() - today.getTime(),
shengyuD = parseInt(shenyu / (60 * 60 * 24 * 1000)),
D = parseInt(shenyu) - parseInt(shengyuD * 60 * 60 * 24 * 1000),
shengyuH = parseInt(D / (60 * 60 * 1000)),
H = D - shengyuH * 60 * 60 * 1000,
shengyuM = parseInt(H / (60 * 1000)),
M = H - shengyuM * 60 * 1000;
shengyuS = parseInt((shenyu - shengyuD * 60 * 60 * 24 * 1000 - shengyuH * 60 * 60 * 1000 - shengyuM * 60 * 1000) / 1000);
if (shengyuS < 10) {
shengyuS = "0" + shengyuS
} else {
shengyuS
}
if (shengyuH < 10) {
shengyuH = "0" + shengyuH
} else {
shengyuH
}
if (shengyuM < 10) {
shengyuM = "0" + shengyuM
} else {
shengyuM
}
if (shengyuD < 10) {
shengyuD = "0" + shengyuD
} else {
shengyuD
}
document.getElementById("time1").innerHTML = shengyuD;
document.getElementById("time2").innerHTML = shengyuH;
document.getElementById("time3").innerHTML = shengyuM;
document.getElementById("time4").innerHTML = shengyuS;
setTimeout("clock()", 500);
}
打开App,阅读手记