[javascript]浮动广告
<html> <head><meta http-equiv=Content-Type content="text/html;charset=utf-8"> <title></title></head> <body> <div id="Ad" style="position:absolute"> <a href="http://www.cnblogs.com/co1d7urt" target="_blank"> <img src="3.jpg" border="0" /></a></div> <script> var x=50; var y=60; var xin=true; var yin=true; var step=1; var obj=document.getElementById("Ad"); function floatAd() { var L=T=0; var R=document.body.clientWidth-obj.offsetWidth; var B=document.body.clientHeight-obj.offsetHeight; obj.style.left=x+document.body.scrollLeft; obj.style.top=y+document.body.scrollTop; 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;} } var itl=setInterval("floatAd()",10); obj.onmouseover=function(){clearInterval(itl)}; obj.onmouseout=function(){itl=setInterval("floatAd()",10)}; </script> </body> </html>