div里有个iframe,ifram嵌套了一个页面a.aspx
我怎么样做才能在关闭a.aspx这个页面的时候让div关闭/隐藏?
谢谢各路高手!

解决方案 »

  1.   

    如果关闭是指跳转到另外页面,那么在 a.aspx 的 body 中加事件 
    onbeforeunload="parent.document.getElementById('div的ID').style.display='none';"
      

  2.   

    <html>
    <head>
    <script type="text/javascript">
    function setUnload(ifm){
    var win = ifm.contentWindow || ifm;
    win.onunload = function(){
    document.getElementById('wrap').style.display = 'none';
    }
    }
    </script>
    </head>
    <body style="background:#000000;">
    <div id="wrap" style="background:#ffffff; display:block;">
    <iframe id="test" src="inner.html" width="500" height="40" onload="setUnload(this);">
    </iframe>
    </div>
    </body>
    </html>