延迟页面的响应时间

<% 

Response.Buffer = true

 

Function WaitFor(SecDelay,ShowMsg)

    timeStart = Timer()

    timeEnd = timeStart + SecDelay

 

    Msg = "Timer started at " & timeStart & "<br>"

    Msg = Msg & "Script will continue in "

 

    i = SecDelay

    Do While timeStart < timeEnd

        If i = Int(timeEnd) - Int(timeStart) Then

        Msg = Msg & i

        If i <> 0 Then Msg = Msg & ", "

        If ShowMsg = 1 Then Response.Write Msg

%>

 

<%         Response.Flush() %>

 

<%

        Msg = ""

        i = i - 1

        End if

        timeStart = Timer()

    Loop

    Msg = "...<br>Slept for " & SecDelay & " seconds (" & _

        Timer() & ")"

    If ShowMsg = 1 Then Response.Write Msg

End Function

 

Call WaitFor(5,0)

Call WaitFor(3,1)

%>

 

 

    相关文章

评论

发表新评论

此内容将保密,不会被其他人看见。
点击刷新验证码
  • 可用的 UBB 标签:
  • 留言最长字数:1000。