asp如何实现点击数的计算?

时间:2010-05-18 18:39:00 

如下:
counter.htm

<a href=counter.asp?save=123&url=http://127.0.0.1/>http://127.0.0.1</a> 
共点击次数:<script src=view.asp?save=123></script> 

counter.asp

<% 
path="d:data" 
file=request("save") 
url=request("url") 
Set fs = CreateObject("Scripting.FileSystemObject") 
if fs.FileExists(path & file & ".txt") then 
Set thisfile = fs.OpenTextFile(path & file & ".txt", 1, False) 
number=thisfile.readline + 1 
thisfile.Close 
Set outfile=fs.CreateTextFile(path & file & ".txt") 
outfile.WriteLine number 
outfile.close 
set fs=nothing 
else 
number=1 
Set outfile=fs.CreateTextFile(path & file & ".txt") 
outfile.WriteLine number 
outfile.close 
set fs=nothing 
end if 
response.redirect url 
%> 
view.asp
<% 
path="d:data" 
file=request("save") 
Set fs = CreateObject("Scripting.FileSystemObject") 
if fs.FileExists(path & file & ".txt") then 
Set thisfile = fs.OpenTextFile(path & file & ".txt", 1, False) 
number=thisfile.readline 
thisfile.Close 
set fs=nothing 
else 
number=0 
end if 
response.contenttype = "application/x-javascript" 
response.write "document.write(""" & number & """);" 
%>

标签:点击数,asp
0
投稿

猜你喜欢

  • 解构用户研究

    2010-03-15 12:34:00
  • PHP文件运行步骤以及数据库的连接代码

    2023-05-25 08:32:51
  • Oracle 函数大全[字符串函数,数学函数,日期函数]第1/4页

    2009-03-04 10:56:00
  • 人民币的符号的正确表示法?一杠?两杠?¥还是¥呢?

    2010-03-24 12:21:00
  • Asp性能优化之Response.IsClientConnected属性及其应用示例

    2008-09-18 12:13:00
  • ASP 支持中文的len(),left(),right()的函数代码

    2011-03-03 10:59:00
  • Sql server数据库优化

    2010-04-06 19:17:00
  • ASP 判断是否有中文的代码

    2011-04-15 11:07:00
  • 我的css样式写法总结

    2009-01-18 13:04:00
  • 多语言网站开发 不完全技术分析

    2008-02-18 12:52:00
  • asp 判断上传文件中是否存在危险代码

    2011-03-17 11:19:00
  • 给页面加上Loading效果最简单实用的办法

    2008-11-20 11:58:00
  • 在网页中实现细线边框的两种方法

    2011-06-14 09:47:26
  • SQLserver 数据库危险存储过程删除与恢复方法

    2011-09-30 11:33:54
  • 如何使用 SQL Server 数据库查询累计值

    2008-12-03 15:27:00
  • 能否用显示/隐藏层来控制FLASH播放与停止

    2008-10-27 14:08:00
  • 设计模式-自动完成

    2010-11-30 21:44:00
  • sqlserver数据库迁移后,孤立账号解决办法

    2011-10-24 20:01:40
  • Firefox Bug: inline/inline-block的间隙

    2009-11-03 13:20:00
  • oracle 数据库连接分析

    2009-07-28 10:42:00
  • asp之家 网络编程 m.aspxhome.com