理论上应该可以通过if(window.opener.close)window.close实现,在了页面设置循环调用该语句

解决方案 »

  1.   

    代码如下:
    <script language="javascript">
    var a = new Array();
    function abc(){
      a.length = 1;
      a[0] = window.open("b.aspx");
      a.length = 1;
      a[1] = window.open("b.aspx");
    }function closeW(){
      for(var i=0;i<a.length;i++)
      a[i].close();
    }
    </script>
      

  2.   

    每Open一个窗口,数组长度加1,并指向Open的窗口,关闭父窗口时,循环关闭数组里的窗口就是了。
      

  3.   

    问题已经解决,我本来是用子页面去更新父页面的元素,以通知子页面已经打开了。其实不用这样做的。
    详情: mainPage.aspx var subPage = null;
    function checkMessage() 
    {   
        if(subPage == null || subPage.closed
        {             
            var xmlMsg = new ActiveXObject("Microsoft.XMLHTTP"); 
            //调用服务页面 
            xmlMsg.open("GET","servicePage.aspx",false); 
            xmlMsg.send(); 
            //如果有数据更新,就弹出提示页面 
            if(xmlMsg.responseText != "")             
            { 
                var str = xmlMsg.responseText;                 
                subPage = window.open("childPage.aspx","childPage"); 
            }             
        } 

    checkMessage();     
    window.setInterval("checkMessage()",180000); 
      

  4.   

    suano的方法在Maxthon下成功,在IE下不成功(JS提示:没有权限)。