当前位置: 代码网 > it编程>编程语言>其他编程 > 如何实现点击数的计算?

如何实现点击数的计算?

2024年05月18日 其他编程 我要评论
counter.htm<a href=counter.asp?save=123&url=http://127.0.0.1/>http://127.0.0.1</a> 共点击次数:<script

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 & """);"
%

[1]

(0)

相关文章:

版权声明:本文内容由互联网用户贡献,该文观点仅代表作者本人。本站仅提供信息存储服务,不拥有所有权,不承担相关法律责任。 如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 2386932994@qq.com 举报,一经查实将立刻删除。

发表评论

验证码:
Copyright © 2017-2025  代码网 保留所有权利. 粤ICP备2024248653号
站长QQ:2386932994 | 联系邮箱:2386932994@qq.com