问题:在index.html 中,iframe 引入son.html,在son.html 中如何点击某个操作,实现屏蔽整个页面,并弹出要显示的层? 准备: index.html son.html 思路: 一:index.html中iframe引入son.html , 复制代码代码如下: 二: index.html的body部分中添加屏蔽层和内容展示层 复制代码代码如下: 三:index.html 中设置div的样式和实现打开关闭层的方法 复制代码代码如下: <br>#BgLayer { <br>background: #939393 none repeat scroll 0 0; <br>height:100%; <br>width:100%; <br>left:0; <br>top:0; <br>filter: alpha(opacity=80); /* IE */ <br>-moz-opacity: 0.8; /* Moz FF */ <br>z-index: 10000; <br>} <br>#Layer { <br>width: 400px; <br>height: 400px; <br>margin: -180px 0 0 -170px; <br>left: 50%; <br>top: 50%; <br>position: absolute; <br>background: #FFF; <br>z-index: 10001; <br>border: 1px solid #1B5BAC; <br>} <br> <br>/*显示页面*/ <br>function showDiv) { <br>var bg = document.getElementById("BgLayer"); <br>var con = document.getElementById("Layer"); <br>//var w = document.documentElement.clientWidth; //网页可见区域宽 <br>//var h = document.documentElement.clientHeight;//网页可见区域高 <br>var w = document.body.scrollWidth; //网页正文全文宽 <br>var h = document.body.scrollHeight; //网页正文全文高 <br>// alert(w "-" h); <br>bg.style.display = ""; <br>bg.style.width = w "px"; <br>bg.style.height = h "px"; <br>con.style.display = ""; <br>} <br>/*关闭*/ <br>function closeDiv() { <br>var bg = document.getElementById("BgLayer"); <br>var con = document.getElementById("Layer"); <br>bg.style.display = "none"; <br>con.style.display = "none"; <br>} <br> 四:son.html 中某个操作调用父页面方法 复制代码代码如下: 查看