求一个asp的倒计时的方法

来源:百度知道 编辑:UC知道 时间:2024/05/30 19:24:18
例如:结束时间是10月1日(这个日期是从数据库里取出来的)在页面上显示的效果是和时钟一样1000毫秒刷新一次的

建议将数据从数据库中读取出来之后用Javascript实现

<%

Function CountDown(dtmWhenEnds)
dtmNow = Now()
If dtmWhenEnds > dtmNow Then
intDiffsR = DateDiff("s", dtmNow, dtmWhenEnds)
intDiffmR = intDiffsR \ 60
intDiffhR = intDiffmR \ 60
intDiffdR = intDiffhR \ 24
intDiffsA = intDiffsR - (intDiffmR * 60)
intDiffmA = intDiffmR - (intDiffhR * 60)
intDiffhA = intDiffhR - (intDiffdR * 24)
intDiffdA = intDiffdR

If intDiffdA = 1 Then
strDayS = "天"
Else
strDayS = "天"
End If

strTimeLeft = strTimeLeft & intDiffdA & strDayS

If intDiffhA = 1 Then
strHourS = "小时"
Else
strHourS = "小时"
End If

strTimeLeft = strTimeLeft & intDiffhA & strHourS

If intDiffmA = 1 Then
strMinuteS = "分"
Else
strMinuteS = "分"
End If

strTimeLeft = strTi