当前位置: 移动技术网 > IT编程>开发语言>其他编程 > 如何实现点击数的计算?

如何实现点击数的计算?

2017年12月08日  | 移动技术网IT编程  | 我要评论

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]

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网