Javascript跨Iframe增删DIV层
在1.html中,通过
var bgObj=document.createElement("div");
bgObj.setAttribute('id','msgDiv');
创建msgDiv层,在这个层里Iframe了2.html。
1.html页面中,删除这个msgDiv层只用document.body.removeChild(bgObj);就行了;
2.html页面中,却需要window.parent.document.body.removeChild(window.parent.document.getElementById("msgDiv"));来删除。
做个记号!!!
var bgObj=document.createElement("div");
bgObj.setAttribute('id','msgDiv');
创建msgDiv层,在这个层里Iframe了2.html。
1.html页面中,删除这个msgDiv层只用document.body.removeChild(bgObj);就行了;
2.html页面中,却需要window.parent.document.body.removeChild(window.parent.document.getElementById("msgDiv"));来删除。
做个记号!!!