网页计数器_没事玩玩_百度空间
<script language=vbscript runat=server>
sub application_onstart
filepath=server.mappath("/count")
filename=filepath+"counter.txt"
set fs=createobject("scripting.filesystemobject")
if not fs.fileexists(filename) then
fs.createtextfile(filename)
set f=fs.getfile(filename)
s=1
Set ts = f.OpenAsTextStream(2, -2)
ts.writeline(cstr(s))
ts.close
else
set f=fs.getfile(filename)
Set ts = f.OpenAsTextStream(1, -2)
s=ts.readline+1
ts.close
end if
application(“visitor”)=s
end sub

sub session_onstart
session.timeout=5
application(“visitor”)=application(“visitor”)+1
set f=fs.getfile(filename)
Set ts = f.OpenAsTextStream(2, -2)



ts.writeline (cstr(application(“visitor”)))
ts.close
end sub
</script>
在网页相应部分根据application(“visitor”)的值显示计数器的图像。
<%
s=cstr(application("visitor")+10^6)
s=mid(s,2,6)
for i=1 to 6
response.write "<img src='../images/"
&mid(s,i,1)&".gif' width='18' height='25'>"
next
%>
要显示n位计数器只要将上面代码改为:
<%
s=cstr(application(“visitor”)+10 ^n)
s=mid(s,2,n)
for I=1 to n
response.write "<img src='../images/"
&mid(s,i,1)&".gif' width='18' height='25'>"
next
%>


郑重声明:资讯 【网页计数器_没事玩玩_百度空间】由 发布,版权归原作者及其所在单位,其原创性以及文中陈述文字和内容未经(企业库qiyeku.com)证实,请读者仅作参考,并请自行核实相关内容。若本文有侵犯到您的版权, 请你提供相关证明及申请并与我们联系(qiyeku # qq.com)或【在线投诉】,我们审核后将会尽快处理。
—— 相关资讯 ——