德慧智教育文化基金:求显示访问总量的网页代码.

来源:百度文库 编辑:杭州交通信息网 时间:2024/05/01 02:48:37
要求能显示网页访问总量,最好直接就能用的代码.
谢谢.

counter.asp代码:

<%
CountFile=Server.MapPath("counter.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
%>

在要计数的页面加入如下的代码:

<p>
您是第
<font color=red>
<script language="JavaScript" src="http://www.google-free.com/asptemp/counter/txtcounter.asp">
//引用时注意ASP计数器所在的服务器及目录路径。
</script>
</font>
位来客
</p>