iframe内页面中的div遮罩整个iframe
<tablestyle="width:945px"cellpadding="0"cellspacing="0"><tr><tdstyle="vertical-align:...
<table style="width: 945px" cellpadding="0" cellspacing="0">
<tr>
<td style="vertical-align:top" >
<iframe src="a.htm" name="leftFrame" scrolling="no" noresize="noresize" width="250px" topmargin="0" id="leftFrame" frameborder="0"></iframe>
</td>
<td style="vertical-align:top;">
<iframe src="b.html" name="mainFrame" noresize="noresize" scrolling="no" width="695px" id="mainFrame" frameborder="0"></iframe>
</td>
</tr>
</table>
a.html 裏面有一个div 当点击a页面中的按钮时 div显示 并且遮罩整个页面 也就是遮罩起来iframe
求过路大侠指教 能给个小demo最好了 先挂5分 有合适答案会追 先谢谢了 展开
<tr>
<td style="vertical-align:top" >
<iframe src="a.htm" name="leftFrame" scrolling="no" noresize="noresize" width="250px" topmargin="0" id="leftFrame" frameborder="0"></iframe>
</td>
<td style="vertical-align:top;">
<iframe src="b.html" name="mainFrame" noresize="noresize" scrolling="no" width="695px" id="mainFrame" frameborder="0"></iframe>
</td>
</tr>
</table>
a.html 裏面有一个div 当点击a页面中的按钮时 div显示 并且遮罩整个页面 也就是遮罩起来iframe
求过路大侠指教 能给个小demo最好了 先挂5分 有合适答案会追 先谢谢了 展开
2个回答
展开全部
test1.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>test1</title>
</head>
<body>
<iframe width="200px" height="200px" src="test2.html"></iframe>
</body>
</html>
test2.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>test2</title>
<script>
function show(){
var div=document.createElement("div");
div.style.width=parent.document.documentElement.scrollWidth+"px";
div.style.height=parent.document.documentElement.scrollHeight+"px";
div.style.backgroundColor="red";
div.style.position="absolute";
div.style.left=0;
div.style.top=0;
div.style.zIndex=9999;
if(document.all)
div.style.filter = "alpha(opacity=30)";
else div.style.opacity = .3;
parent.document.body.appendChild(div);
}
</script>
</head>
<body>
<input type="button" value="测试" onclick="show()" />
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>test1</title>
</head>
<body>
<iframe width="200px" height="200px" src="test2.html"></iframe>
</body>
</html>
test2.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>test2</title>
<script>
function show(){
var div=document.createElement("div");
div.style.width=parent.document.documentElement.scrollWidth+"px";
div.style.height=parent.document.documentElement.scrollHeight+"px";
div.style.backgroundColor="red";
div.style.position="absolute";
div.style.left=0;
div.style.top=0;
div.style.zIndex=9999;
if(document.all)
div.style.filter = "alpha(opacity=30)";
else div.style.opacity = .3;
parent.document.body.appendChild(div);
}
</script>
</head>
<body>
<input type="button" value="测试" onclick="show()" />
</body>
</html>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询