请问如何做一个专业的图片计数器?
<%
countlong=8
' 定义计数器位数.
On Error Resume Next
' 忽略所有的错误.
count=server.mappath(count.txt)
set cou = server.createobject(scripting.filesystemobject)
set out=cou.opentextfile(count,1,false,false)
counter=out.readline
out.close
' 打开count.txt,读出目前计数器的值.
if session(in)<>in then
' 判断用户是否已进入主页,防止用户刷新或再次来到此页面时计数器再加1.
session(in)=in
set out = cou.createtextfile(count,true,false)
application.lock
counter=counter+1
' 计数器加1 .
out.writeline(counter)
application.unlock
out.close
' 建立新文件count.txt并写入加1后计数器的值.
end if
co=cstr(counter)
' 把数字型变量转换成字符型.
for i = 1 to countlong-len(co)
' 得到前面0图片的个数.
response.write
next
' 完成计数器前面的0图片的添加.
for i= 1 to len(co)
response.write
next
' 从变量co的第i位开始读.
%>
[1]
时间: 2024-10-03 15:11:57