我所需要的是在a.html能够自动监测 弹出的b.html 是否被关闭的代码(摸拟onwinb.close事件)
。(setTimeout或setInterval来刷新 的,这种不要)谢谢。

解决方案 »

  1.   

    可以做到。
    <script>
     var newwin=null;
     function openwin(){
       newwin=window.open("b.htm","b");
       de();
     }
     function de(){
       if (newwin.document.readyState=="complete"){
           newwin.document.body.onunload=function(){
             alert ("b窗口已关闭")
           }
       }else setTimeout("de()","100");
     }</script>
    <body id="a" onload="openwin()">
    </body>
      

  2.   

    winb.closed = true;
    表示弹出的窗口已经关闭!
      

  3.   

    <script type="text/javascript">
    var win = window.open('','','width=300,height=200');
    var checkWindow = function(){
    if(win.closed == true){
    alert("窗口已经关闭");
    }else{
    alert("窗口未关闭");
    }
    }
    </script>
    <input type="button" value="检测" onclick="checkWindow();" />
      

  4.   

    不行呀。lfecnu:用了 setTimeout,来刷新,这个不好。
    cvpc(一回) :要求主动接收,不由用户点击检测。就像 winb.onmousedown,winb.onmouseover,这些能自动事件
      

  5.   

    除非你在打开的窗口里写<body onbeforeunload
    这个事件里返回一个信息
      

  6.   

    你设置个timeout,再判断openWindow.closed是不是为true就可以拉