晕。。。。。只是显示一个在线的东西,怎么用搞的那么麻烦,用最兼容的办法写一个,VBscript可以吗?是否也出现这么多不定的因素??
我的网站也有这个问题,不过用xp sp1和2003不装sp1就正常了,装完xp sp2和2003sp1以后就是这个样子,98系统也正常,浏览器版本都是一样的,而且只要是基于IE内核的浏览器都一样,IE的java虚拟机也升级了,一样没用,我已经郁闷很久了,希望能在这里找到答案.
[此贴子已经被作者于2006-8-13 2:32:29编辑过]
你用下面这段代码来替换<img src="OnlineCount.asp">显示当前在线人数试试:
<%
cnt=0
dnt=0
s=Request.ServerVariables("path_translated")
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
cName=Server.MapPath("chy.cnt")
dName=Server.MapPath("dchy.cnt")
Set objCountFile = objFSO.OpenTextFile(cName,1,True)
If Not objCountFile.AtEndOfStream Then cnt=CLng(objCountFile.ReadAll)
objCountFile.Close
Set objCountFile=Nothing
cnt=cnt+1
Set objCountFile=objFSO.CreateTextFile(cName,True)
objCountFile.Write cnt
objCountFile.Close
Set objCountFile=Nothing
if application("dntime")<=cint(hour(time())) then
Set objCountFile = objFSO.OpenTextFile(dName,1,True)
If Not objCountFile.AtEndOfStream Then dnt=CLng(objCountFile.ReadAll)
objCountFile.Close
Set objCountFile=Nothing
end if
application("dntime")=cint(hour(time()))
dnt=dnt+1
Set objCountFile=objFSO.CreateTextFile(dName,True)
objCountFile.Write dnt
objCountFile.Close
Set objCountFile=Nothing
Set objFSO = Nothing
t=(cint(day(date()))*24+cint(hour(time())))*60+cint(minute(time()))
k=0
i=1
y=0
Do While application("zxip"&i)<>""
if application("zxip"&i)=Request.ServerVariables("REMOTE_ADDR") then
application("zxsj"&i)=t
y=1
end if
if t-application("zxsj"&i)>9 or t<application("zxsj"&i) then
k=k+1
else
if k>0 then
application.lock
application("zxip"&i-k)=application("zxip"&i)
application("zxsj"&i-k)=application("zxsj"&i)
application.unlock
end if
end if
if k>0 then
application.lock
application("zxip"&i)=""
application.unlock
end if
i=i+1
loop
if y=0 then
application("zxip"&i)=Request.ServerVariables("REMOTE_ADDR")
application("zxsj"&i)=t
else
i=i-1
end if%>
<tr><td><b><%=i%></b></div>
有道理
不客气,原来的代码我如何修改也不能用了,郁闷