与页面分离的图象计数器imgcounter.asp代码:
$#@60;% @language="VBScript"%$#@62;
$#@60;%
dim images(20)
定义一数组,用来存放显示每一位数字图象的语句
CountFile=Server.MapPath("imgcounter.txt")
Set FileObject=Server.CreateObject("Scripting.FileSystemObject")
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
Out.WriteLine(counter)
Application.unlock
countlen=len(counter)
得到计数器值的位数
for i=1 to countlen
images(i)="$#@60;img src="&"http://202.101.209.75/asptemp/counter/images/"&"/" & mid(counter,i,1) & ".gif$#@62;$#@60;/img$#@62;"
由循环语句得到各个位上数值对应图象的显示代码(html),并把它存在数组中
具体使用时请注意图象的实际服务器及目录路径
response.write"document.write("&images(i)&");"
调用函数Document.write输出显示数字图象的html代码
next
Out.Close
%$#@62;
在要计数的页面加入如下的代码:
$#@60;p$#@62;
您是第
$#@60;script language="JavaScript" src="http://202.101.209.75/asptemp/counter/imgcounter.asp"$#@62;
//引用时注意ASP计数器所在的服务器及目录路径。
$#@60;/script$#@62;
位来客
$#@60;/p$#@62;
附注:以上asp计数器均在Windows NT Server 4.0(中文) / IIS3.0 下测试通过。以下任何一种环境都可执行ASP:
一、Windows NT Server 4.0 / IIS3.0以上
二、Windows NT WorkStation 4.0 / Microsoft Peer Web Service3.0以上
三、Windows 95/98 / Microsoft Personal Web Server 1.0a以上
文章整理:西部数码--专业提供域名注册、虚拟主机服务
http://www.west263.com
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!




