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

Posted on 2009-11-16 18:28  严武  阅读(271)  评论(0编辑  收藏  举报

 说明:

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
%>

Copyright © 2024 严武
Powered by .NET 8.0 on Kubernetes