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

来源:asp之家 时间:2011-03-31 11:04:00 

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,不推荐访问量大的站使用……

标签:asp,延时,延迟
0
投稿

猜你喜欢

  • 彻底弄懂CSS盒子模式之一(DIV布局快速入门)

    2007-05-11 17:03:00
  • asp网上购物车实例代码

    2007-10-03 13:43:00
  • 一个小技巧mysql命令行分页

    2011-01-29 16:33:00
  • DIV+CSS高度自适应网页代码实例

    2008-09-20 08:00:00
  • ASP编程如何执行存储过程?

    2010-03-17 20:56:00
  • DW实现滚动新闻

    2007-12-03 11:35:00
  • MySql 随机取N条数据

    2009-03-17 12:46:00
  • 慎用UL列表

    2009-03-25 20:21:00
  • 网页设计之文字的辨识度与可读性

    2007-10-26 16:19:00
  • 搜索结果页(SERP):前言

    2009-07-22 20:56:00
  • CSS Hack经验总结

    2008-05-01 13:13:00
  • WEB2.0时代活动类网页我们该如何设计?

    2009-12-16 12:19:00
  • 实战手记:让百万级数据瞬间导入SQL Server

    2010-06-07 14:13:00
  • Christopher Schmitt 谈学习CSS的益处

    2008-07-13 14:15:00
  • 设计模式-自动完成

    2010-11-30 21:44:00
  • 验证码的最高境界

    2008-05-08 14:17:00
  • Web内容写作:得到更好稿件的头15条规则[译]

    2011-06-09 14:38:00
  • 优化Oracle停机时间及数据库恢复

    2010-07-20 12:54:00
  • 网站数据库,是选SQL Server还是Access好

    2008-05-23 13:19:00
  • css2.1实现多重背景和边框效果

    2010-06-23 19:02:00
  • asp之家 网络编程 m.aspxhome.com