一个漂浮的广告浮层-通杀ff和IE

星期一, 2010-09-20 | Author: Lee | pagemaker | 4,383 views

用的时候找到个,方便以后使用了,通杀ff和IE

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<div id="ad" style="position:absolute">   
<a href="//www.pomelolee.com/" target="_blank">   
<img src="http://www.feicha61.com/myextends/52dianying/images/02.jpg" border="0">   
</a></div>  
<script>   
var x = 50,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 = document.body.clientHeight-obj.offsetHeight   
 
obj.style.left = x + document.body.scrollLeft+"px"   
 
obj.style.top = y + document.body.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 }    
 
}   
var itl= setInterval("floatAD()", delay)    
obj.onmouseover=function(){clearInterval(itl)}    
obj.onmouseout=function(){itl=setInterval("floatAD()", delay)}   
</script>

Tags: , , ,

文章作者: Lee

本文地址: https://www.pomelolee.com/664.html

除非注明,Pomelo Lee文章均为原创,转载请以链接形式标明本文地址

No comments yet.

Leave a comment

Search

文章分类

Links

Meta