当前位置:编程学习 > asp >>

如何制作一个倒计时的程序?

答案:

<%
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>

[1]

上一个:如何最准确地统计在线用户数?
下一个:如何利用当前时间生成随机函数?

CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,