<script type="text/javascript">
function wHeight(){
    var height = null;
    window.innerHeight ? height = window.innerHeight : height = document.documentElement.clientHeight;
    return height;
    }
var bodyheight = wHeight();
var x = 50,y = 60
var xin = true, yin = true
var step = 1
var delay = 20
var obj=document.getElementById("codefans_net")
function floatAD() {
    var L=T=0
    var R= document.body.clientWidth-obj.offsetWidth;
    var B = bodyheight-obj.offsetHeight;
    obj.style.left = x+"px";
    obj.style.top = y+"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>

posted on 2012-09-17 15:27  somesayss  阅读(715)  评论(0编辑  收藏  举报