当前位置: 代码网 > it编程>编程语言>其他编程 > 如何随机显示图片计数器?

如何随机显示图片计数器?

2024年05月18日 其他编程 我要评论
count.asp< html >< head >< meta http-equiv="content-type"content="text/html; charset=gb2312" ><title

count.asp
html
head
meta http-equiv="content-type"
content="text/html; charset=gb2312"

title>随风起舞之千变计数器</title
/head
body
p
%
dim out
countfile=server.mappath("aspcount.txt")
set objfile=server.createobject("scripting.filesystemobject")

' 定义一个服务器组件.
set out=objfile.opentextfile(countfile,1,false,false)
counter=out.readline

' 读取数据.
out.close
set objfile=server.createobject("scripting.filesystemobject")
set out=objfile.createtextfile(countfile,true,false)
application.lock

' 暂时锁定.
counter=counter+1

' 访客次数加1.
out.writeline(counter)

' 写入数据.
application.unlock

' 解锁.
out.close
%

script language="javascript"
function countdisp(countvar){
var countvar1="000000"+countvar;

' 实现随机显示,不足6位以0补全.
var howfar1=countvar1.length;
countvar1=countvar1.substring(howfar1, howfar1-1)
var index=""+math.floor(math.random()*10);
if (index=="10"){
index="0"};
for (var icount=0;icount
6;icount++{
var g=countvar1.substring(icount,icount+1);
document.images[icount].src="http://
localhost/images/"+index+g+".gif";
}

/script></p
!--预载图像数组--
您是第<img src="http://localhost/images/00.gif" height=20 width=20
img src="http://localhost/images/00.gif" height=20 width=20
img src="http://localhost/images/00.gif"height=20 width=20
img src="http://localhost/images/00.gif"height=20 width=20
img src="http://localhost/images/00.gif"height=20 width=20
img src="http://localhost/images/00.gif"height=20 width=20>位访问者!
script language="javascript"
count(counter);

' 调用count()函数,实现计数器的动态图像显示.
/script
/body
/html

[1]

(0)

相关文章:

版权声明:本文内容由互联网用户贡献,该文观点仅代表作者本人。本站仅提供信息存储服务,不拥有所有权,不承担相关法律责任。 如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 2386932994@qq.com 举报,一经查实将立刻删除。

发表评论

验证码:
Copyright © 2017-2025  代码网 保留所有权利. 粤ICP备2024248653号
站长QQ:2386932994 | 联系邮箱:2386932994@qq.com