萬盛學電腦網

 萬盛學電腦網 >> 網絡編程 >> 編程語言綜合 >> 如何制作一個倒計時的程序

如何制作一個倒計時的程序

 <%

CountdownDate = #1/1/2008 00:00:00AM#
If Date >= CountdownDate Then
    Response.Write "2008  北京"
    Response.End
End If

theDate    = Now
DaysLeft    = DateDiff("d",theDate,CountdownDate) - 1
theDate    = DateAdd("d",DaysLeft,theDate)
HoursLeft  = DateDiff("h",theDate,CountdownDate) - 1
theDate    = DateAdd("h",HoursLeft,theDate)
MinutesLeft = DateDiff("n",theDate,CountdownDate) - 1
theDate    = DateAdd("n",MinutesLeft,theDate)
SecondsLeft = DateDiff("s",theDate,CountdownDate) - 1
%>

<html>
<body>
現在時間: <%= Now %>
<p>
距離2008年還有 <%= DaysLeft%>天<%= HoursLeft %> 小時<%= MinutesLeft %>分 <%= SecondsLeft %>秒.走得最急的,都是最美的時光.
</body></html>

copyright © 萬盛學電腦網 all rights reserved