我點了一個按鈕,並在其中放置了一個javascript函數來打開一個新窗口,如果再次單擊該按鈕,同一個窗口再次刷新並指向它。在firefox和chrome中工作。但不是在IE.Here是我試圖焦點功能在ie8中不工作
<button onclick="popitup('http://www.google.com');">click</button>
var newwindow = null;
function popitup(url) {
if ((newwindow == null) || (newwindow.closed)) {
newwindow = window.open(url, 'Buy', 'width=950,height=650,scrollbars=yes,resizable=yes');
newwindow.focus();
} else {
newwindow.location.href = url;
newwindow.focus();
}
}
IE回報newwindow == NULL所有的時間碼...這是問題...任何解決辦法嗎?
這是如何使用C#的? –
默認的按鈕行爲是'submit',所以試着設置'type ='button'' – Grundy
檢查IE是否阻止彈出窗口,也可能重複[在IE9上,Win 7 window.open()返回null而不是引用打開窗口](http://stackoverflow.com/questions/7014242/on-ie9-win-7-window-open-returns-null-instead-of-reference-of-the-opened-wind) – Grundy