谁有For NT+Asp的计数器?高分购买!

hiphis 2000-06-28 12:44:00
...全文
387 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
zyc 2000-06-28
  • 打赏
  • 举报
回复
ASP的计数器不少,其实在ASP中(2.0以上版本)就有两个组件可以做计数器,它们是counter组件和pagecounter组件(用法请参看有关文档,其中pagecounter不一定包含在ASP的安装中)。在我的主页(http://www.hehu.com)上也有个计数器,还可以提供免费申请使用。如你要源码,可发信至zyc@lianjiang.gov.cn。
你也可以到其它的有免费代码的网站下载一个asp的网站计数器源码.
linyu 2000-06-28
  • 打赏
  • 举报
回复
1。
在根目录下新建一个文本文件:
counter.txt
随便加一个数字(起始计数)在第一行;
2。
在global.asa中添加:
<script language="VBScript" runat="Server">
Sub Application_OnStart
Set fs = Server.CreateObject("Scripting.FileSystemObject")
counter_file = Server.MapPath("/counter.txt")
Set txt = fs.OpenTextFile( counter_file )
Application("counter") = cdbl(txt.ReadLine)
txt.Close

' 将FileSystemObject对象及counter.txt的实际路径
' 保存Application对象中
Set Application("fs") = fs
Application("counter_file") = counter_file

End Sub

Sub Application_OnEnd
' 将保存在 Application 对象中 FileSystemObject 对象
' 及counter.txt 的实际路径读出来
Set fs = Application("fs")
counter_file = Application("counter_file")

Set txt = fs.CreateTextFile( counter_file, True )
txt.WriteLine(cstr(Application("counter")))
txt.Close
End Sub

</script>

3。
需要调用的页面加入下面代码:
<%
if not session("enterisok") then
session("enterisok")=true
application.lock
if Application("counter")<=0 then
Application("counter")=1
else
Application("counter")=Application("counter")+1
end if
session("count")=Application("counter")
application.unlock
end if
'在页面上写计数
response.write session("count")
%>



w102272 2000-06-28
  • 打赏
  • 举报
回复
我有一个组件,可以做计数器,来mail吧:
wxj@public.east.net.cn

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧