700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > html 图片浮动代码 JavaScript实现的浮动图片广告

html 图片浮动代码 JavaScript实现的浮动图片广告

时间:2019-11-12 09:28:08

相关推荐

html 图片浮动代码 JavaScript实现的浮动图片广告

JavaScript实现的浮动图片广告_网页代码站()

var imagepath="/logo.gif"

var imagewidth=88;

var imageheight=31;

var speed=6;

var imageclick="/"; //广告图片链接

var hideafter=0;

var isie=0;

if(window.navigator.appName=="Microsoft Internet Explorer"&&window.navigator.appVersion.substring(window.navigator.appVersion.indexOf("MSIE")+5,window.navigator.appVersion.indexOf("MSIE")+8)>=5.5) {

isie=1;

}

else {

isie=0;

}

if(isie){

var preloadit=new Image()

preloadit.src=imagepath

}

function pop() {

if(isie) {

x=x+dx;y=y+dy;

oPopup.show(x, y, imagewidth, imageheight);

if(x+imagewidth+5>screen.width) dx=-dx;

if(y+imageheight+5>screen.height) dy=-dy;

if(x<0) dx=-dx;

if(y<0) dy=-dy;

startani=setTimeout("pop();",50);

}

}

function dismisspopup(){

clearTimeout(startani)

oPopup.hide()

}

function dowhat(){

if (imageclick=="dismiss")

dismisspopup()

else

window.open(imageclick);

}

if(isie) {

var x=0,y=0,dx=speed,dy=speed;

var oPopup = window.createPopup();

var oPopupBody = oPopup.document.body;

oPopupBody.style.cursor="hand"

oPopupBody.innerHTML = '';

oPopup.document.body.οnmοuseοver=new Function("clearTimeout(startani)")

oPopup.document.body.οnmοuseοut=pop

oPopup.document.body.οnclick=dowhat

pop();

if (hideafter>0)

setTimeout("dismisspopup()",hideafter*1000)

}

网页代码站 - 最专业的网页代码下载网站 - 致力为中国站长提供有质量的网页代码!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。