网站图片随意全屏漂浮JS

hh.js文件内容

document.writeln("<div id=\"ad\" style=\"position:absolute\"><img src=\"me.jpg\" \/><\/div>");
document.writeln(" <script>");
document.writeln(" var x = 600,y = 80");
document.writeln(" var xin = true, yin = true");
document.writeln(" var step = 2 ");
document.writeln(" var delay = 20");
document.writeln(" var obj=document.getElementById(\"ad\") ");
document.writeln(" function floatAD() {");
document.writeln(" var L=T=0");
document.writeln(" var R= document.body.clientWidth-obj.offsetWidth");
document.writeln(" var B = document.body.clientHeight-obj.offsetHeight");
document.writeln(" obj.style.left = x + document.body.scrollLeft");
document.writeln(" obj.style.top = y + document.body.scrollTop");
document.writeln(" x = x + step*(xin?1:-1) ");
document.writeln(" if (x < L) { xin = true; x = L} ");
document.writeln(" if (x > R){ xin = false; x = R} ");
document.writeln(" y = y + step*(yin?1:-1) ");
document.writeln(" if (y < T) { yin = true; y = T } ");
document.writeln(" if (y > B) { yin = false; y = B } ");
document.writeln(" }");
document.writeln(" var itl= setInterval(\"floatAD()\", delay) ");
document.writeln(" obj.οnmοuseοver=function(){clearInterval(itl)} ");
document.writeln(" obj.οnmοuseοut=function(){itl=setInterval(\"floatAD()\", delay)}");
document.writeln(" <\/script>")
t.writeln(" <\/script>")

 

 

调用就在<head>到</head>中加<script src="hh.js"></script>

若有flash的话,可能会跑到flash下面去了,要设置一下flash参数


   <param name="wmode" value="opaque">

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值