| |
简单的ASP网页计数器源代码


说明:

1、在网站目录下新建一个文本:txtcounter.txt 在文本填写1或其他识字

2、新建一asp文件:count.asp,加入以下代码:

<%  
CountFile=Server.MapPath("txtcounter.txt")  
Set FileObject=Server.CreateObject("Scripting.FileSystemObject")  
Set Out=FileObject.OpenTextFile(CountFile,1,FALSE,FALSE)  
counter=Out.ReadLine  
Out.Close  
SET FileObject=Server.CreateObject("Scripting.FileSystemObject")  
Set Out=FileObject.CreateTextFile(CountFile,TRUE,FALSE)  
Application.lock  
counter= counter + 1  
Out.WriteLine(counter)  
Application.unlock  
Response.Write"document.write("&counter&")"
'为了在页面正确显示计数器的值,调用VBScript函数Document.write
Out.Close
%>


3、在需要计数的网页加入:总访问

现在看网页就是可以计数了!  
不指定 2008年5月18日 20:28, Marshal, Computer, 评论(0), 阅读(4835)
发表评论
开启/隐藏 高级扩展
昵称
密码  游客无需密码
网址
电邮   [注册]