让访问者每来一次看到不同的图片?用计数器就很简单地实现了!
源程序如下:
<%
----------------------------------------------------------计数程序开始
dim fileobject,countfile,out,counter,picno,pp
set fileobject=server.createobject("scripting.filesystemobject")
countfile=server.mappath("count.txt")
set out=fileobject.opentextfile(countfile,1,false,false)
counter=out.readline
out.close
set fileobject=server.createobject("scripting.filesystemobject")
set out=fileobject.createtextfile(countfile,true,false)
application.lock
counter= counter + 1
----------------------------------------------------------计数程序结束
if counter>99 then counter=0 不能超过某个值,这个地
方你注意了,不能跟显示的数字变量一样:(
if counter<10 then 我现在只有10张图片,10以下是
多 少就显示多少
picno=counter
else
picno=(counter mod 10) 大于10只取个位,因为我一共只有10
张 图片:(
end if
out.writeline(counter) 把当前的计数值存在counter.txt里面
application.unlock
out.close
%>
本例所用的存计数值的方法是用的文本文件进行存取
显示图片
<%response.write("<img src="&"images/face/face"&picno&".jpg width=229 height=160>")%>
文章整理:站长天空 网址:http://www.z6688.com/
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!




