<html>
<head>
<title>倒计时</title>
<body>
<script language=JavaScript>
Time = new Date();
var now = new Date((Time.getMonth()+1) + "/" + Time.getDate() + "/" + Time.getFullYear() + " " + Time.getHours() + ":" + Time.getMinutes() + ":" + Time.getSeconds());
function GetServerTime()
{
var urodz = new Date("7/3/2010 00:00:00");
now.setTime(now.getTime()+250);
days = (urodz - now) / 1000 / 60 / 60 / 24;
daysRound = Math.floor(days);
hours = (urodz - now) / 1000 / 60 / 60 - (24 * daysRound);
hoursRound = Math.floor(hours);
minutes = (urodz - now) / 1000 /60 - (24 * 60 * daysRound) - (60 * hoursRound);
minutesRound = Math.floor(minutes);
seconds = (urodz - now) / 1000 - (24 * 60 * 60 * daysRound) - (60 * 60 * hoursRound) - (60 * minutesRound);
secondsRound = Math.round(seconds);
document.getElementByIdx_x("date").innerHTML = daysRound;
document.getElementByIdx_x("time").innerHTML = hoursRound + ":" + minutesRound + ":" + secondsRound;
}
setInterval("GetServerTime()",250);
</script>
距离********还有<span id="date"></span> <span class="white14b">天</span> <span id="time"></span>
</body>
</html>
javascript实现倒计时
最新推荐文章于 2022-06-15 17:09:49 发布