asp实现页面延迟运行的两个简单方法

来源:asp之家 时间:2007-10-16 13:49:00 

asp之家注:有时候我们想让程序运行变慢下来,asp中该怎么做呢?原理很简单就是在运行程序前运行一段无关紧要的程序就可以了,要实现加长程序的运行时间还是很容易的,最简单的方法做个FOR循环。


for i=0 to 5000
next


如果觉得延迟时间太短大家可以修改参数值,或再嵌套一个for。

下面是两个页面延迟运行的asp方法:

一、 TimerWait = 5 这里设置运行延迟的时间单位秒



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


二、


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


' 你可以改变这个的数字

<% TimeDelaySeconds(2) %>


标签:延迟,for,运行
0
投稿

猜你喜欢

  • 关于 Python json中load和loads区别

    2021-04-24 20:30:51
  • Python生成随机数的方法

    2022-10-18 12:57:28
  • 深入解析PHP 5.3.x 的strtotime() 时区设定 警告信息修复

    2023-11-06 19:25:27
  • Kears 使用:通过回调函数保存最佳准确率下的模型操作

    2023-02-24 12:36:56
  • Python 实现选择排序的算法步骤

    2023-04-01 18:28:53
  • 图神经网络GNN算法基本原理详解

    2023-08-08 23:53:53
  • Mybatis报错: org.apache.ibatis.exceptions.PersistenceException解决办法

    2024-01-18 18:58:03
  • 详解SQL Server的聚焦过滤索引

    2024-01-22 06:15:23
  • 利用Pyhton中的requests包进行网页访问测试的方法

    2021-09-11 05:12:48
  • 详解python中@classmethod和@staticmethod方法

    2022-10-24 11:47:16
  • vue中watch监听不到变化的解决

    2024-04-30 10:41:33
  • Go语言入门教程之Arrays、Slices、Maps、Range操作简明总结

    2024-05-09 14:56:40
  • SQL 查询语句积累

    2024-01-27 06:32:18
  • SQLServer与服务器连接时出错的解决方案

    2009-06-28 14:35:00
  • 回调函数的意义以及python实现实例

    2021-07-17 11:42:07
  • python编写函数注意事项总结

    2021-08-19 22:15:10
  • ThinkPHP框架实现用户信息查询更新及删除功能示例

    2024-06-07 15:34:11
  • Access 导入到SQL Server 2005的方法小结

    2024-01-15 12:02:01
  • python实现rsa加密实例详解

    2021-08-24 03:32:51
  • Python定义二叉树及4种遍历方法实例详解

    2021-05-28 06:22:55
  • asp之家 网络编程 m.aspxhome.com