87,907
社区成员
发帖
与我相关
我的任务
分享
<!DOCTYPE HTML>
<html>
<head>
<meta charset="gb2312" />
<title></title>
<style>
</style>
</head>
<body>
<p>1</p>
<p>1</p>
<p>1</p>
<iframe src="3.html" frameborder="0"></iframe>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
<p>1</p>
</body>
</html>
3.html
<!DOCTYPE HTML>
<html>
<head>
<meta charset="gb2312" />
<title></title>
<style>
</style>
</head>
<body>
<button id="btn">遮罩父层</button>
<script>
var $ = function(id){
return document.getElementById(id);
};
var p = parent,
w = p.document.documentElement.clientWidth,
h = Math.max(p.document.documentElement.clientHeight, p.document.body.clientHeight);
$('btn').onclick = function(){
var div = p.document.createElement('div');
div.style.cssText = 'position:absolute;left:0;top:0;background:#999;width:'+w+'px;height:'+h+'px;opacity:.5;filter:alpha(opacity=50);';
p.document.body.appendChild(div);
}
</script>
</body>
</html>