<html>
<head>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<script language="JavaScript" >
function closeFloat(){
document.getElementById("ad").style.display="none";
}
</script>
</head>
<body>
<div id="ad" style="position:absolute">
<a href="http://www.renren.com" target="_blank">
<img src="images/raoxing.jpg" border="0">
</a>
<div class="close">
<a href="javascript:closeFloat()">关闭</a>
</div>
<script>
var x = 10,y = 60 ;
var xin = true, yin = true ;
var step = 0.8;
var delay = 10;
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()", delay) ;
obj.οnmοuseοver=function(){clearInterval(itl)} ;
obj.οnmοuseοut=function(){itl=setInterval("floatAD()", delay);}
</script>
</div>
</body>
</html>
浮动图片
最新推荐文章于 2024-08-16 19:02:09 发布