刚做完1个项目,闲的无聊,想改改自己homepage,但没有asp权限,所以突发奇想,用vbs模拟了一个图片分页显示功能!由于写的是适合自己使用的功能,难免很多地方不是很完善!也请各位路过的提些意见,若有朋友正好想找类似的功能,或许可以帮助一下,另外,祝论坛的每一位朋友元旦快乐!
<script language=vbs>
function showindexpage()
js=1
webpath=window.location
do until left(webpath,1)="#" or js=len(window.location)
js=js+1
webpath=right(window.location,js)
loop
if js=len(window.location) then showindexpage=1 else showindexpage=replace(webpath,"#","")
end function
qz="" '需要显示的图像文件前缀
hz=".gif" '需要显示的图像文件后缀
themax=98 '最大显示图像个数
theskip=5 '每行显示多少图像个数
thepage=20 '每页显示多少图像个数
theindex=int(themax/thepage)
if themax mod thepage <> 0 then theindex=theindex+1
for i=1 to theindex
showindex="<a href=#"&i&" onclick=window.location.reload()>"&"["&i&"]"&"</a> "
document.write showindex
next
document.write "<br><br><hr>"
if thepage=0 then thepage=themax
for i=1 to thepage
thenum=i+thepage*(showindexpage()-1)
if thenum>themax then exit for
if thenum<10 then
temp="<img src="&qz&"00"&thenum&hz&"></img>"
else if thenum<100 then
temp="<img src="&qz&"0"&thenum&hz&"></img>"
else
temp="<img src="&qz&thenum&hz&"></img>"
end if
end if
document.write temp
if theskip<>0 then if i mod theskip = 0 then document.write "<br>"
next
document.write "<hr><br><br>"
for i=1 to theindex
showindex="<a href=#"&i&" onclick=window.location.reload()>"&"["&i&"]"&"</a> "
document.write showindex
next
</script>
另:
取得#后面的内容可以使用
replace(window.location.hash,"#","")
如对本文有疑问,
点击进行留言回复!!
相关文章:
-
-
-
-
-
-
用vbs实现文本循环读取
因为测试中需要读取一批url数据进行浏览,其实使用qtp本身的table能实现多种读取方式,但是因为需要tabel是使用excel保存的,在没有...
[阅读全文]
-
-
-
-
-
网友评论