请问下我使用的是showModalDialog的方式弹出的一个子窗口,我需要用子窗口控制刷新父窗口然后关闭子窗口,必要是在ie8下运行的。
window.parent.dialogArguments.document.execCommand('Refresh');
window.close();这段代码在ie6和遨游上能执行  ie8执行不成功
请高手帮助解答

解决方案 »

  1.   

    <script type="text/javascript">  
    function openSubWin()   
    {
    window.showModalDialog('b.html', 'newwindow', 'height=500, width=400, top=0, left=0, toolbar=no, menubar=yes, scrollbars=yes,resizable=yes,location=no, status=no'); 
    window.location.reload();
     }  
        </script>
      

  2.   

    window.parent.dialogArguments.location.href = window.parent.dialogArguments.location.href;
      

  3.   


    报错了
      
    Error: Invalid procedure call or argumentError: Object Doesn't support this property or method
      

  4.   

    showModalDialog会中断父窗口的JS,只有当打开的窗口关闭后才会继续,原理和alert是一样的
    可以用showModlessDialog打开
      

  5.   

    window.showModalDialog('b.html', window)在b.htmlwindow.dialogArguments.location.reload();
    window.close(); 
      

  6.   

    你其实可以刷新父窗口然后关闭子窗口,至少在你这个顺序的JS来说感官上应该没差别或者差别甚微吧?可以利用子窗口returnValue返回给父窗口,然后父窗口来判断是否需要刷新或者其他。
    父窗口
    function openNewWindow (){
        var returnVal = window.showModalDialog('b.html', window);
       if(returnVal == "xxx")
          window.location.reload();
    }b.html 
    fucntion closeWindow(){
    window.returnValue="xxx";   
    window.close();
    }
      

  7.   

    我也在解决这个问题。等待高中解答中"<script>window.dialogArguments.location.reload();window.close();</script>"  IE8 一点效果都没有,IE6可以正常运行的。
      

  8.   

    子窗口关闭时可以传一个参数回去的,根据参数不同再操作父窗口吧。
    先刷新再关就不知道了<input type="button" value="continue" onclick="window.returnValue='2';window.close();"/>
      

  9.   

    另外我记得可以把父窗口的window对象传guoqu
      

  10.   

    可以在js里添加一个函数
    function refreshParent(){
    var win=window.dialogArguments;
    win.location.replace(win.location); 
    }
    然后再在showModalDialog打开子窗口中的body标签添加onunload="refreshParent();"