点击链接弹出一个层(ContentDiv),该层中包括一个iframe标签,链接至另一文件,文件中有一个链接,如何通过这个iframe包含文件中的链接关闭层(ContentDiv)如:
a.html内容
<a href="javascript:showDiv('ContentDiv')">打开图层</a>
<div id="ContentDiv" style="display: none">
        <center>
            <strong>编辑客户资料</strong></center>
        <iframe name="edit" style="border: none; margin: 0px; width: 100%; height: 776px;"
            frameborder="0" scrolling="no" id="edit" src="b.html"></iframe>
    </div>b.html内容
<a href="">点击链接关闭层<a/>如何通过b.html中的链接关闭a.html文件中的ContentDiv层?

解决方案 »

  1.   

    直接调用父页面的 hideDiv 方法看看:window.parent.hideDiv("ContentDiv");
      

  2.   

    不行!没有反应
    function hideDiv(objID) {
        alert(document.getElementById(objID).style.display);//此处弹出为none
        document.getElementById(objID).style.display = "none";
    }
    window.parent.hideDiv(\"ContentDiv\");
      

  3.   

    不行!没有反应
    function hideDiv(objID) {
      alert(document.getElementById(objID).style.display);//此处弹出为none
      document.getElementById(objID).style.display = "none";
    }
    window.parent.hideDiv("ContentDiv");
      

  4.   

      alert(document.getElementById(objID).style.display);//此处弹出为none
      document.getElementById(objID).style.display = "none";
    改成 alert(window.top.document.getElementById(objID).style.display);
    window.top.document.getElementById(objID).style.display