江苏快3

你好,游客 登录 注册 搜索
背景:
阅读新闻

网页漂浮窗口代码

[日期:2015-03-01] 来源:  作者: [字体: ]

漂浮窗口代码

<div id="ad" style="position:absolute"><a href=http://www.sunsprite.net target="_blank"><img src="img01.gif" border="0"></a></div>

江苏快3<script>

var x = 50,y = 60

江苏快3var xin = true, yin = true

var step = 1

var delay = 10

var obj=document.getElementById("ad")

江苏快3function 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)

江苏快3if (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)}