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">