<%
'******************************************************************************************************
'asp文本记数器
'Powered by myhon
'Date:2006-05-15
'counter.asp:统计点击次数
'counter.cnt:实际是一个文本文件,保存点击的次数
'使用方法:在需要进行记数的页面中加入:
'注意counter.asp,couner.cnt两个文件引用的路径要正确
'******************************************************************************************************
dim path,myFile,read,write,cntNum
path=server.mappath("counter.cnt")
read=1
write=2
Set myFso = Server.CreateObject("Scripting.FileSystemObject")
set myFile = myFso.opentextfile(path,read)
cntNum=myFile.ReadLine
myFile.close
cntNum=cntNum+1
set myFile = myFso.opentextfile(path,write,TRUE)
myFile.write(cntNum)
myFile.close
set myFile=nothing
set myFso=nothing
%>
document.write('<%=cntNum%>');