【问题标题】:refresh base window from pop up window in asp.net从asp.net中的弹出窗口刷新基本窗口
【发布时间】:2013-01-17 07:53:32
【问题描述】:

我正在使用 A 页面打开一个弹出窗口 B

this.Page.ClientScript.RegisterStartupScript(  
      this.GetType(), 
      "JavaScript", 
     "myWindow=window.open('B.aspx',
     'WindowName',
     'copyhistory=no, 
     width=800, 
     height=300, 
     top=150, 
     left=50, 
     resizable=1, 
     scrollbars=1');
     myWindow.focus();", 
     true
);

每当弹出窗口B发生变化时,我都想刷新页面A

【问题讨论】:

    标签: c# asp.net


    【解决方案1】:

    有很多方法可以做到:

    <script>
        window.onunload = refreshParent;
        function refreshParent() {
            window.opener.location.reload();
        }
    </script>
    
    <script language="JavaScript">
    <!--
    function refreshParent() {
      window.opener.location.href = window.opener.location.href;
    
      if (window.opener.progressWindow)
    
     {
        window.opener.progressWindow.close()
      }
      window.close();
    }
    //-->
    </script>
    

    来源:

    Open popup and refresh parent page on close popup

    http://forums.devarticles.com/javascript-development-22/auto-refresh-parent-window-after-closing-popup-4864.html

    Refresh parent window when the pop-up window is closed

    【讨论】:

      【解决方案2】:

      在用户操作上调用refreshParent

      function refreshParent() {
           window.opener.location.href = window.opener.location.href;
      }
      

      【讨论】:

        猜你喜欢
        • 2015-09-26
        • 1970-01-01
        • 1970-01-01
        • 2012-07-09
        • 2011-05-15
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多