Asp 防止网页频繁刷新一法

下面示例代码是防止用网页刷新过快,如果多个页面使用,最好将<%...%>代码存为一个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 防止网页频繁刷新一法 - 51windows.Net</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>
文章来自: 51windows.net
引用通告: 查看所有引用 | 我要引用此文章
Tags:
评论: 0 | 引用: 0 | 查看次数: 3138
发表评论
昵 称:
密 码: 游客发言不需要密码.
验证码: 1+4=?
内 容:
选 项:
虽然发表评论不用注册,但是为了保护您的发言权,建议您注册账号.
字数限制 500 字 | UBB代码 关闭 | [img]标签 关闭