那这个弹出层就把iframe中的内容全部遮住了,我想要的是,弹出的层把整个父页面遮住,但还有一个message的div呢,这个也遮住了,这个有办法实现吗
追答这个简单,正常的遮罩效果都是有一个不被挡住的div,我现在是做了个简单的。
在test1.html中加入下面的div:
这样这个div就在上面档不住了。
可这个不遮住的div中的内容在iframe页面中啊
追答这样的话就稍微麻烦点,要想不被挡住只能把这个div添加到父页面。
然后使用父页面调用子页面函数的方法来实现操作子页面。
iframe的父页面操作子页面网上很多的,找下就知道了。
用别的有可以实现这种效果的?
追答如下是可以的(注意用到的 top.document):
test1.html
test1
test2.html
test2
function show(){
var div=top.document.createElement("div");
div.style.width=top.document.documentElement.scrollWidth+"px";
div.style.height=top.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(top.document.all)
div.style.filter = "alpha(opacity=30)";
else div.style.opacity = .3;
alert(top.document.getElementById("ddd").id);
top.document.getElementById("ddd").appendChild(div);
}