国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > 綜合 > 正文

飄浮廣告顯示腳本類(VBS,JS雙版)

2024-07-21 02:15:32
字體:
來源:轉載
供稿:網友
在寫一個項目時要用到廣告模塊,為了不想用asp生成腳本代碼時較麻煩,于是產生了寫腳本類的念頭,即是用一個類模塊的腳本代碼去控制所有在同一頁面顯示的漂浮廣告。但在寫的過程中發現js腳本竟然在settimeout里不能使用類的方法。奇怪,是不是我弄錯了還是js腳本就不能這樣??但vbs腳本就可以!我暈……

不說了,貼代碼:
[vbs腳本代碼]


以下是代碼片段:
'/****************漂浮廣告顯示類****************************************************
'/* 作者:死在水中的魚
'/* 腳本語言:vbs
'/* 用法:
'/* set adver1=new adverclass
'/* adver1.objname="adver1" '設置當前的對象名 [本身對象變量名]
'/* adver1.imgtype=1 '圖片的類型 0=普通圖片 1=flash動畫
'/* adver1.imagewidth=299 '圖片的寬度
'/* adver1.imageheight=87 '圖片的高度
'/* ####以下方法顯示廣告圖片(flash) 對象.printhtml "圖片地址","鏈接地址","提示信息"
'/* adver1.printhtml "http://edu.qq.com/flash/moto-button.swf","http://www.chinese.bj.cn/' target="_blank" >http://edu.qq.com/flash/moto-button.swf","http://www.chinese.bj.cn/","這是什么"
'/***********************************************************************************
class adverclass
public divid
public objname
private objdiv
public delay '改變數
public imgtype
private istep
private itop,ileft,width,height
private topflag,leftflag
'廣告圖片的大小
public imagewidth,imageheight
private sub class_initialize
randomize
divid=int(rnd(time)*9999+1)
delay=80
height=document.body.clientheight
width=document.body.clientwidth
itop=0
ileft=0
topflag=false:leftflag=false
istep=3
imgtype=0 '0 是圖片 1 是flash文件
imagewidth=0
imageheight=0
end sub
private sub class_terminate
end sub
public sub scrollimg()
dim offheight,offwidth,irnd
offwidth=objdiv.offsetwidth
offheight=objdiv.offsetheight
objdiv.style.left = ileft + document.body.scrollleft
objdiv.style.top = itop + document.body.scrolltop
irnd=int(rnd(time)*99+1)
if irnd>97 then topflag=not topflag
irnd=int(rnd(time)*9+1)
if irnd>98 then leftflag=not leftflag
if topflag then
itop=itop+istep*rnd(time)
else
itop=itop-istep*rnd(time)
end if
if leftflag then
ileft=ileft+istep*rnd(time)
else
ileft=ileft-istep*rnd(time)
end if
if itop<0 then
itop=0
topflag=true
elseif itop>height-offheight then
itop=height-offheight
topflag=false
end if
if ileft<0 then
ileft=0
leftflag=true
elseif ileft>width-offwidth then
ileft=width-offwidth
leftflag=false
end if
end sub
private sub start()
setinterval objname&".scrollimg()", delay
end sub
public sub printhtml(byval imgsrc,byval adhref,byval adtitle)
if imgtype=0 then
call printimagehtml(imgsrc,adhref,adtitle)
else
call printflashhtml(imgsrc,adhref,adtitle)
end if
execute "set objdiv=document.all.img"&divid
ileft=int(rnd(time)*(width-100)+1)
itop=int(rnd(time)*(height-100)+1)
objdiv.style.top=itop
objdiv.style.left=ileft
call start()
end sub
private sub printimagehtml(byval imgsrc,byval adhref,byval adtitle)
if imagewidth=0 or not isnumeric(imagewidth) then
imagewidth=""
else
imagewidth=" width='"&imagewidth&"'"
end if
if imageheight=0 or not isnumeric(imageheight) then
imageheight=""
else
imageheight=" height='"&imageheight&"'"
end if
document.write "<div id=""img"&divid&""" style=""position:absolute;"">"
document.write "<a href="""&adhref&""" target=""_blank"" title='"&adtitle&"'>"
document.write "<img src="""&imgsrc&""" alt="""&adtitle&""" border=""0"""&imagewidth&imageheight&"></a></div>"
end sub
private sub printflashhtml(byval imgsrc,byval adhref,byval adtitle)
if imagewidth=0 or not isnumeric(imagewidth) then
imagewidth=80
end if
imagewidth=" width='"&imagewidth&"'&q

國內最大的酷站演示中心!
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 瓮安县| 白朗县| 分宜县| 青冈县| 泾阳县| 临安市| 灵山县| 临泽县| 新疆| 顺昌县| 长兴县| 营山县| 临漳县| 衡水市| 乌鲁木齐县| 静安区| 周口市| 墨竹工卡县| 富民县| 瓦房店市| 金沙县| 陵水| 南川市| 新巴尔虎左旗| 奉贤区| 南昌市| 丹凤县| 新野县| 正阳县| 嘉鱼县| 横峰县| 平舆县| 万年县| 兰州市| 澎湖县| 彰武县| 吉林省| 怀宁县| 自贡市| 惠安县| 措勤县|