码迷,mamicode.com
首页 > Web开发 > 详细

飘窗代码修改了一段js

时间:2015-05-13 16:10:36      阅读:263      评论:0      收藏:0      [点我收藏+]

标签:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>

<body >



    <div id=ad style="WIDTH:1024; POSITION: absolute; HEIGHT: 99px; z-index:500000" onMouseOver="stop()" onMouseOut="start()" >
        <table width=90>
            <tbody>
                <tr>
                    <td>这里填写内容</td>
                </tr> 
                <tr>  
                    <td>
                        <!--<div align=right><a onclick=stopAd() href="javascript:void(null);" style="font-size:12px;">关闭 </a></div>-->
                        <div align=right><a onclick="stopAd()">关闭&nbsp;</a></div>
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
    <script>
var x = 100,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 = 1000
        obj.style.left = x + document.documentElement.scrollLeft+"px";
        //alert(document.body.scrollLeft+"");
        obj.style.top = y + document.documentElement.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 } 
    }
    function stopAd(){
        obj.style.display = none;
        clearInterval(itl);
    }
    var itl= setInterval("floatAD()", delay) 
    obj.onmouseover=function(){clearInterval(itl)} 
    obj.onmouseout=function(){itl=setInterval("floatAD()", delay)}
    </script>    
    
    


</body>
</html>

平常心就好!大不了怎样

飘窗代码修改了一段js

标签:

原文地址:http://www.cnblogs.com/woxiangxintj/p/4500672.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!