<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>无标题文档</title> </head> <body > <div id=ad style="WIDTH:1024; POSITION: absolute; HEIGHT: 99px; z-index:500000" onMouseOver="stop()" onMouseOut="start()" > <table width=90> <tbody> <tr> <td>这里填写内容</td> </tr> <tr> <td> <!--<div align=right><a onclick=stopAd() href="javascript:void(null);" style="font-size:12px;">关闭 </a></div>--> <div align=right><a onclick="stopAd()">关闭 </a></div> </td> </tr> </tbody> </table> </div> <script> var x = 100,y = 60 var xin = true, yin = true var step = 1 var delay = 10 var obj=document.getElementById("ad") function floatAD() { var L=T=0 var R= document.body.clientWidth-obj.offsetWidth; var B = 1000 obj.style.left = x + document.documentElement.scrollLeft+"px"; //alert(document.body.scrollLeft+""); obj.style.top = y + document.documentElement.scrollTop+"px"; x = x + step*(xin?1:-1) if (x < L) { xin = true; x = L} if (x > R){ xin = false; x = R} y = y + step*(yin?1:-1) if (y < T) { yin = true; y = T } if (y > B) { yin = false; y = B } } function stopAd(){ obj.style.display = ‘none‘; clearInterval(itl); } var itl= setInterval("floatAD()", delay) obj.onmouseover=function(){clearInterval(itl)} obj.onmouseout=function(){itl=setInterval("floatAD()", delay)} </script> </body> </html>
平常心就好!大不了怎样
时间: 2024-11-06 03:46:59