一个div遮罩的简单实现

1 在页面上首先设置如下两个div层
<div id="divMask" style="DISPLAY: none; Z-INDEX: 999; FILTER: alpha(opacity=50); LEFT: 0px; WIDTH: 1024px; POSITION: absolute; TOP: 0px; BACKGROUND-COLOR: silver; TEXT-ALIGN: center; opacity: 0.5; moz-opacity: 0.5"></div>
<div id="divPop" style="DISPLAY:none; Z-INDEX:1000; LEFT:400px; POSITION:absolute; TOP:350px"    align="center"></div>
2 设置遮罩
window.parent.document.getElementById("divMask").style.height=window.parent.document.body.scrollHeight;
              //显示遮罩
              window.parent.document.getElementById("divMask").style.display = 'block';
               window.parent.document.getElementById("divPop").style.display = 'block';
               window.top.scrollTo(0,0);

posted on 2010-01-07 13:52  风乔  阅读(454)  评论(0编辑  收藏  举报

导航