************************调用*********************
'* <script language="javascript" src="xxx.asp?max=8"></script>
'*************************************************
javastr="<div algin='center'>"
<%
max=Request("max") '//计数器位数
If Request.cookies("count")="" Then '//防刷
Set fso=Server.CreateObject("Scripting.FileSystemObject")
Set fp=fso.OpenTextFile(Server.MapPath("count.dat")) '//计数器统计文件
countn=fp.Readline
countn=countn+1
Fp.close
Set fp=Nothing
set fp=fso.createtextfile(server.mappath("count.dat"))
fp.Writeline countn
set fp=nothing
set fso=nothing
Response.Cookies("count")=countn
End If
Set fso=Server.CreateObject("Scripting.FileSystemObject")
Set fp=fso.OpenTextFile(Server.MapPath("count.dat"))
s=fp.Readline
For n=(max-len(s)) to 1 step -1
%>
javastr=javastr+"<img src=http://edu.chinaz.com/Get/Program/Asp/count/0.gif' border=0>" '//计数器图片文件
<%
Next
j=0
For i=(max-len(s)) to max-1
j=j+1
%>
javastr=javastr+"<img src='http://edu.chinaz.com/Get/Program/Asp/count/<%=mid(s,j,1)%>.gif' border=0>"
<%
Next
Set fp=Nothing
Set fso=Nothing
javastr=javastr+"</div>"
%>
document.write(javastr)
关键词:ASP计数器