海海日记-冯海滨博客

您现在的位置是:首页 > 站长 > 正文

站长

访问统计代码—记录访问人数

happyfhb2011-05-05站长1371

下面是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、在需要统计的网页加入:总访问<script language="JavaScript" src="count.asp"></script>次

平淡中储蓄成长

发表评论

评论列表

  • 这篇文章还没有收到评论,赶紧来抢沙发吧~