救命--!!在线==,一个关于做浮动广告的问题!!??
我有个人网站,上面有flash图片,现在我想给我的网站做个 浮动的广告, 但是浮动的广告,飘到 flash ,和flash 重叠时,就隐藏到了flash 后面!! 不知道代码哪地方有问题!
<body>
<div id="ad" style="position:absolute"><a href="http://www.game-win.com" target="_blank"><img src="img/logo.jpg" border="0"></a></div>
<script>
var x = 150,y = 160
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
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.onmouseover=function(){clearInterval(itl)}
obj.onmouseout=function(){itl=setInterval("floatAD()", delay)}
</script>
参考答案:表格的Z值比div高,所以总是压在下面~~