本帖最后由 lijiayao07 于 2012-03-23 20:07:09 编辑

解决方案 »

  1.   

    IE8不可以的啊,会报这个错误:被调用的对象已与其客户端断开连接。
    我在公司,在家里,在朋友电脑上 都试了,,用的IE8,都是报这个错误。
      

  2.   

    可以换种思路,如下
    1.在b.html中
       win.onbeforeunload = function(){winList[a] = null;};
      换为
       win.wid = a;
      其余代码,均保持原样2.在a.html中写入如下脚本块  <script>
       window.onbeforeunload =function(){
    opener.winList[opener.wid] = null;
        } 
       </script>
      

  3.   

    3楼,你好,那个a.html,不是我的,是别人的。这个a.html也可以是www.csdn.net,不能在a.html里面写东西的。
      

  4.   

    2楼 你把那个a.html关掉,再点To a.html就会报错了。你不关掉a.html是不会有错的
      

  5.   


    <script>
    function aa(obj){
    var a = obj.id;
    if(!window.winList){
    window.winList={};
    }
    if(!winList[a]){
    var url="http://www.baidu.com";
    var win = window.open("","_blank","width=300,height=300,resizable=yes",true);
    win.document.write('<html><head><script>window.onbeforeunload =function(){opener.winList["'+a+'"] = null;}<\/script><\/head>');
    win.document.write('<body><iframe src="'+url+'" width="100%" height="100%" frameborder="0"><\/iframe><\/body><\/html>');
    winList[a] = win;
    }else{
    var win = winList[a]; 
    win.focus();
    }
    }</script><input type="button" value="To a.html" onclick="aa(this)" id="a"/>