欢迎光临
我们一直在努力

一个实现任意改变计数器位数的函数。

建站超值云服务器,限时71元/月

$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 

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 一个实现任意改变计数器位数的函数。
分享到: 更多 (0)