45IT.COM- 电脑学习从此开始!
DIY硬件教程攒机经验装机配置
设计Photoshop网页设计特效
系统注册表DOS系统命令其它
存储主板显卡外设键鼠内存
维修显卡CPU内存打印机
WinXPVistaWin7unix/linux
CPU光驱电源/散热显示器其它
修技主板硬盘键鼠显示器光驱
办公ExcelWordPowerPointWPS
编程数据库CSS脚本PHP
网络局域网QQ服务器
软件网络系统图像安全
页面导航: 首页 > 设计学院 > 网络编程 > ASP教程 >

ASP记录点击数的实现

电脑软硬件应用网 45IT.COM 时间:2005-12-30 19:26 作者:45IT收集

在HTML中用法 

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

%> 

顶一下
(0)
0%
踩一下
(0)
0%
------分隔线----------------------------
无法在这个位置找到: baidushare.htm
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
验证码:点击我更换图片
推荐知识