asp网页制作小提问

来源:百度知道 编辑:UC知道 时间:2024/07/06 22:31:31
我想做一个网站计数器,可是人数不能用图片来显示,如果不用图片显示又能正确显示,不知道是什么问题:
<%
Function G_Counts(CounterFile)
dim objFSO, objTS, Counts, StrCounts
application.Lock
'锁定Application对象
set objFSO=server.createobject("scripting.filesystemobject")
'建立一个filesystemobject对象实例
set objTS=objFSO.opentextfile(server.mappath(CounterFile),1,true)
'打开文件,文件名为counterfile,仅供读取,若文件不存在则自动建立
if not objTS.atendofstream then '检查是否到达文件的结尾
counts= clng(objTS.readline) '读取计数器的数值并利用Clng函数转换为长整数
end if
'计数器加1
counts=counts+1
'关闭文件
objTS.close
set objTS=objFSO.opentextfile(server.mappath(CounterFile),2,true)
'打开文件,文件名为Countfile,仅供写入,若文件不存在则自动建立
objTS.writeline(counts)
'将新的数值写入文件
objTS.close
'关闭文件
application.UnLock
'对application对象解除锁定
StrCounts=cstr(counts)
'利用cstr()函数将计数器的

你说的情况,说明你计数器方面没问题,是你的数字和图片对应的代码出了问题,有2种情况,一是你的代码出了问题,二是你的图片路径没写对,
你把
for i=1 to len(StrCounts)
G_Counts=G_Counts & "<img src=digit "& mid(StrCounts, i, 1)& ".jpg>"
'取出strcounts的第i个字符,并将其对应到相应的数字图像上
next
改成
for i=1 to len(StrCounts)
if i=1 then
G_Counts="<img src=digit "& mid(StrCounts, i, 1)& ".jpg>"
else
G_Counts=G_Counts & "<img src=digit "& mid(StrCounts, i, 1)& ".jpg>"
endif
next