2014-04-15 34 views
0

我需要關閉瀏覽器中現有的父窗口選項卡,同時關閉子窗口彈出窗口。但我可以做到打開新的父窗口並關注它。是否有可能打開現有的父窗口瀏覽器選項卡與重點?如何在關閉子彈出窗口時關注現有的父瀏覽器選項卡?

我的代碼

function closepopup() { 
     var winRef = window.opener.location; 
     var parentwindow = window.open(winRef, ''); 
     parentwindow.focus(); 
     window.close(); 
     return false; 
    } 
+0

「但我能打開新的父窗口辦和重點吧。」 - 我根本不明白這一點。 – pennstatephil

+0

[如何將焦點返回到使用javascript的父窗口?](http://stackoverflow.com/questions/6910278/how-to-return-focus-to-the-parent-window-using-javascript) – pennstatephil

回答

0

檢查下面的代碼

window.opener.document.forms(0)." & Your Parent Control Id & ".focus(); 
window.close(); 
return false; 
相關問題