关于计数器的问题

来源:百度知道 编辑:UC知道 时间:2024/05/22 10:55:08
代码如下:
<center>
你是第
<% dim vistors
whichfile=server.mappath("counter/counter.txt")
set fs=server.createobject("scripting.filesystemobject")
set thisfile=fs.opentextfile(whichfile)
vistors=thisfile.readline
thisfile.close
countlen=len(vistors)
for i=1 to 5-countlen
response.write"<img src=counter/o.gif>"
next
for i=1 to countlen
response.write"<img src=counter/"&mid(vistors,i,1)&".gif></img>"
next
vistors=vistors+1
set out=fs.createtextfile(whichfile)
out.writeline(vistors)
out.close
set fs=nothing
%>
位访问者
</center>
为什么在显示以零结尾的数字时(比如20,30,40等)最后一张图片(0.gif)显示不出来,前面的数字都正常

response.write"<img src=counter/o.gif>"

估计是把数字零,写成字母 opq 的 o 了

/0的 话说明字符串结束了,就不会度下面的。gif了自然就终止了。用其他字符代替吧。