$u2 forum rautinee原创$
$http://u2bbs.126.com$
下面的函数将实现任意改变计数器位数,你要做的准备工作是:
1、999_count.txt建立一个文本文件,并把初始值设为0。
2、准备一组数字图片放在gif目录下
function gcounter(counterlen)counterlen是计数器的位数
countfile=server.mappath("999_count.txt")
set fileobject=server.createobject("scripting.filesystemobject")
set out=fileobject.opentextfile(countfile,1,false,false)
counter=out.readline读取999_count.txt里面的计数值
out.close
set fileobject=server.createobject("scripting.filesystemobject")
set out=fileobject.createtextfile(countfile,true,false)
application.lock
counter=counter+1累计加1
out.writeline(counter)
application.unlock
out.close
dim s, i, g ,n
s = cstr( counter )
if len(s)<counterlen then
for n = 1 to counterlen-len(s)
g = g&"<img src=gif/0.gif>"
next
end if
for i = 1 to len(s)
g = g & "<img src=gif/" & mid(s, i, 1) & ".gif>"
next
response.write g
end function
