+ -
当前位置:首页 → 问答吧 → 请问下京东的限时抢购是怎么实现的呢?

请问下京东的限时抢购是怎么实现的呢?

时间:2010-05-16

来源:互联网

如图所示:

1.jpg (19.17 KB)
2010-5-16 09:19

作者: mataoking   发布时间: 2010-05-16

//倒记时
<!-- Begin
function getTime() {
now = new Date();
y2k = new Date("Jan 10 2010 19:00:00");
days = (y2k - now) / 1000 / 60 / 60 / 24;
daysRound = Math.floor(days);
hours = (y2k - now) / 1000 / 60 / 60 - (24 * daysRound);
hoursRound = Math.floor(hours);
minutes = (y2k - now) / 1000 /60 - (24 * 60 * daysRound) - (60 * hoursRound);
minutesRound = Math.floor(minutes);
seconds = (y2k - now) / 1000 - (24 * 60 * 60 * daysRound) - (60 * 60 * hoursRound) - (60 * minutesRound);
secondsRound = Math.round(seconds);
document.getElementById("input1").innerHTML = hoursRound + ":" + minutesRound + ":" + secondsRound;
newtime = window.setTimeout("getTime();", 1000);
}
//  End -->

作者: radom   发布时间: 2010-05-16

谢谢

作者: mataoking   发布时间: 2010-05-18