欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

asp 延时 页面延迟的三种方法

程序员文章站 2022-05-08 13:09:59
asp页面延迟的两个简单方法 asp延时第一种 复制代码 代码如下:<% response.buffer = true %> <% ' setup the...
asp页面延迟的两个简单方法
asp延时第一种
复制代码 代码如下:

<% response.buffer = true %>
<%
' setup the variables necessary to accomplish the task
dim timerstart, timerend, timernow, timerwait
' how many seconds do you want them to wait...
timerwait = 5
' setup and start the timers
timernow = timer
timerstart = timernow
timerend = timerstart + timerwait
' keep it in a loop for the desired length of time
do while (timernow < timerend)
' determine the current and elapsed time
timernow = timer
if (timernow < timerstart) then
timernow = timernow + 86400
end if
loop
' okay times up, lets git em outa here
response.redirect "nextpage.html" %>

asp延时二、

复制代码 代码如下:

<%
sub timedelayseconds(delayseconds)
seccount = 0
sec2 = 0
while seccount < delayseconds + 1
sec1 = second(time())
if sec1 <> sec2 then
sec2 = second(time())
seccount = seccount + 1
end if
wend
end sub
%>

' to change delay adjust here
<% timedelayseconds(2) %>

asp延时第三种方法
复制代码 代码如下:

'asp延时方法
sub delaytime(secondnumber)
dim starttime
starttime=now()
do while datediff("s",starttime,now())<secondnumber
loop
end sub

call delaytime(5)

测试用可以,但是这样的代码很占cpu,不推荐访问量大的站使用……