我從子窗口調用父頁面的JavaScript函數,下面的代碼顯示了父頁面上的一些警報消息並關閉了子窗口。如何從Firefox的子窗口中關注父頁面?
window.opener.CallAlert("test is"+test);
opener.focus();
self.close();
上面的代碼片斷髮生了什麼,父窗口發出警報,但焦點仍然保留在子窗口上。我需要明確地去父窗口。一旦我點擊確定警告子窗口關閉。
一切都很好,但我想要專注於父窗口,一旦我從子窗口調用window.opener.CallAlert()
。
編輯
貌似opener.focus();
作品在IE瀏覽器,但不是Mozilla的。任何解決方法爲Firefox?
它不起作用。它只適用於我最大化彈出窗口。沒有最大化它不起作用。 – emilly
hereandnow78,請參閱我的更新 – emilly
請參閱此線程:http://stackoverflow.com/questions/7281758/window-opener-focus-problem-in-ff5 – hereandnow78