簡體   English   中英

如何在按下按鈕時關閉彈出窗口,並在打開彈出窗口的窗口上發起回發?

[英]How do I close a popup window on a press of a button and initiate postback on the window opening the popup?

往上看...

您應該能夠在window.parent中調用函數。

<script type="text/javascript">
    function closeThisPopupWindow()
    {
        if (window.parent && window.parent.callBack)
            window.parent.callBack();
        window.close();
    }
</script>

顯然,您需要將closeThisPopupWindow函數附加到您的按鈕。

嘗試這樣的事情:

parent.document.getElementById('btnSubmit').click();; // submit the parent form
self.close(); // close the current window

我會在彈出窗口的按鈕單擊中執行類似操作

ClientScript.RegisterStartupScript(typeof(string), "auto_refreshparent", @" window.opener.location.reload(); ", true);
ClientScript.RegisterStartupScript(typeof(Page), "ThatsAllFolks", "window.close();", true);

字符串windowArgs =“ toolbar = no,menubar = no,location = no,width = 620,height = 500,scrollbars = yes,resizable = yes,modal = yes”; 字符串newWindowUrl =“ MarketShotPreview.aspx”; 字符串javaScript =“ \\ n” +“ \\ n” +“ \\ n”; ClientScript.RegisterStartupScript(typeof(System.Web.UI.Page),“ Popup”,javaScript);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM