首页 > 代码库 > dom 左右两侧得广告(兼容IE FF)

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

<!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)