簡體   English   中英

關閉彈出窗口后,下一頁將在新標簽頁中打開

[英]After closing popup window next page is opening in new tab

在我的代碼中,我需要打開一個彈出窗口,其中將進行一些工作。 然后,從父頁面開始,我將繼續工作。 問題在於,每當我單擊任意按鈕時,關閉彈出窗口后,下一頁就會在新選項卡中打開。 我在父頁面中調用彈出窗口的代碼如下:

document.auctionForm.action = "/getAcceptance.do";
popup = window.open('', 'view','top=0, left=350, height=500, width=600, toolbar=no, status=no');
document.auctionForm.target = 'view';
document.auctionForm.submit();

當我直接打開下一頁而不打開彈出窗口時,不會發生此問題。 我嘗試通過在彈出窗口關閉時刷新父頁面來修復它,如下所示,但這每次都有效,並且必須手動刷新頁面,這是不可接受的。

window.onunload = refreshParent;
function refreshParent() {
document.auctionForm.target = window.parent;
window.opener.location.reload();
} 

我正在使用struts1。

我通過在提交后將目標更改回父窗口來解決它:

document.auctionForm.action = "/getAcceptance.do";
popup = window.open('', 'view','top=0, left=350, height=500, width=600, toolbar=no, status=no');
document.auctionForm.target = 'view';
document.auctionForm.submit();    
document.auctionForm.target = "_parent";

暫無
暫無

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

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