当前位置: 首页 > 图文教程 > 网络编程 > ASP > ASP实例:Asp 防止网页频繁刷新一法

ASP
ASP中用Join和Array,可以加快字符连接速度。
采用ODBC接口访问MySQL指南
最大限度优化你的Asp性能
实现让每句话的头一个字母都大写
如何尽快释放掉Connection对象建立的连接?
把数据插入到数据库的两种方法
Connection对象的应用
查看ASP Session 变量的小工具
用XMLHTTP组件正确解析图片地址并将其保存
利用XMLHTTP 从其他页面获取数据
Request与Request.Form的速度测试
用SOAP和ASP进行服务器端更新
ASP开发网页时需要牢记的注意事项列表
面向对象的ASP技术:思考与实践
提供一种“间接防止另存为”的方法
格式化数字函数FormatNumber
怎么样写一段高效,安全的sql查询代码
关于Adodb.Stream的使用说明
不用EOF以加快记录循环
防止重复提交的巧妙方法

ASP实例:Asp 防止网页频繁刷新一法


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-08-14   浏览: 121 ::
收藏到网摘: n/a

下面示例代码是防止用网页刷新过快,如果多个页面使用,最好将<%...%>代码存为一个asp文件,在需要的页面最前面include file使用。

以下为引用的内容:

<%
dim RefreshIntervalTime
RefreshIntervalTime = 3 '防止刷新的时间秒数,0表示不防止
If Not IsEmpty(Session("visit")) and isnumeric(Session("visit")) and int(RefreshIntervalTime) > 0 Then
if (timer()-int(Session("visit")))*1000 < RefreshIntervalTime * 1000 then
Response.write ("<meta http-equiv=""refresh"" content="""& RefreshIntervalTime &""" />")
Response.write ("刷新过快,请稍候")
Session("visit") = timer()
Response.end
end if
End If
Session("visit") = timer()
%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Asp 防止网页频繁刷新一法 - webjx.com</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" type="text/css" href="style.css">
<style type="text/css">
</style>
</head>
<body style="background-color:#666666;font-size:36pt;font-family:黑体;color:#FFFFFF;">
页面内容,页面内容
</body>
</html>