All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
ASP.NET实现图象处理详解_[Asp.Net教程]
浅谈javascript中面向对象技术的模拟_JavaScript技术_编程技术
asp.net搜索关键词高亮显示函数_[Asp.Net教程]
帮助你如何迅速优化你MySQL数据库性能_php资料_编程技术
如何在SQL,Server,2005中为安装程序增加计数器注册表项值_mssql学习_编程技术
Apache 2.2 完全参考手册(中文版)_[PHP教程]
关于PHP动态网页session问题的解决方案_php资料_编程技术
制作网页需要学习哪些技术?_[Html教程]
理解才能创新 轻松打造自己的AJAX框架_[AJAX教程]
直接获取插入数据后自增的id_[Asp.Net教程]
Reading number is top 10 pictures
The money of more than 100 countries and regions12
So beauty, will let you spray blood7
史上最大的哺乳动物迁移
猫眯也疯狂
湖南中医院的养生八图
Take you to walk into the most true north Korea rural1
赵惟依写真2
Photographed the passion of the clients and prostitutes in the sex trade picture2
NeedWallpaper12
Discharge accidentally Actresses by the breast3
Download software ranking
Boxer's Top ten classic battle9
Adobe Flash Player(IE) 10.0.32.18 浏览器专用的FLASH插件
功夫熊猫2(下集)
C#程序员参考手册
WebService在.NET中的实战应用教学视频 → 第4集
仙剑奇侠传98版歌曲
虚拟机5.5.3版
Unix video tutorial6
Detective task-the top secret prostitution files
Unix video tutorial18
delv published in(发表于) 2013/12/31 6:57:24 Edit(编辑)
飘浮广告的显示脚本类(VBS,JS双版)_JavaScript技术_编程技术

飘浮广告的显示脚本类(VBS,JS双版)_JavaScript技术_编程技术

飘浮广告的显示脚本类(VBS,JS双版)_JavaScript技术_编程技术-你的首页-uuhomepage.com
在写一个项目时要用到广告模块,为了不想用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 "
"
document.write ""
document.write "

"
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&"'"
If ImageHeight=0 Or Not IsNumeric(ImageHeight) Then
ImageHeight=80
End If
ImageHeight=" height='"&ImageHeight&"'"
document.write "
"
document.write ""
document.write ""
document.write ""
document.write ""
document.write "
"
document.write "

"
End Sub
End Class



添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.