首页 > 其他 > 详细

dom 左右两侧得广告(兼容IE FF)

时间:2015-01-08 11:01:15      阅读:320      评论:0      收藏:0      [点我收藏+]
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<style>
body{
    padding:0px;
    margin:0px;
    }
#wrap{
    height:2000px;
    }    
.ad{
    height:200px;
    width:50px;
    background:pink;
    position:fixed;
    }
.left{
    left:0px;
    }
.right{
    right:0px;
    }    
</style>
<script type="text/javascript">
window.onload = function ()
{
    var oad = document.getElementsByClassName(‘ad‘);
    
    oad[0].style.top = oad[1].style.top = (document.documentElement.clientHeight - oad[0].offsetHeight)/2 + ‘px‘;
};
</script>
</head>

<body>
    <div id="wrap">
        <div class="ad left"></div>
        <div class="ad right"></div>
    </div>
</body>
</html>

 

dom 左右两侧得广告(兼容IE FF)

原文:http://www.cnblogs.com/mayufo/p/4210172.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!