为什么网页中插入的站点计数器在预览时不能正确的显示出数字?

来源:百度知道 编辑:UC知道 时间:2024/06/03 21:05:34

因为你是调用的别人的网站计数器,预览时是不能正确的显示出数字的,建议你自己在里面加入如下代码,预览时就能正确的显示出数字了.

给你代码吧:
<%
' Text Hit Counter Example By www.rczdh.com.cn

' Declare variables
Dim ObjCounterFile, ReadCounterFile, WriteCounterFile
Dim CounterFile
Dim CounterHits

Set ObjCounterFile = Server.CreateObject("Scripting.FileSystemObject")

CounterFile = Server.MapPath ("counter.txt")

Set ReadCounterFile= ObjCounterFile.OpenTextFile (CounterFile, 1, True)

If Not ReadCounterFile.AtEndOfStream Then
CounterHits = Trim(ReadCounterFile.ReadLine)
If CounterHits = "" Then CounterHits = 0
Else
CounterHits = 0
End If

ReadCounterFile.Close
Set ReadCounterFile = Nothing

CounterHits = CounterHits + 1

Set WriteCounterFile= ObjCounterFile.CreateTextFile (