2009-11-28 69 views
1

我已經使用js代碼在新窗口中打開超鏈接。超鏈接打開是單獨的窗口

function openNewWindow() { 
    alert("hello"); 
    var theurl="http://www.google.com"; 
    popupWin = window.open(theurl, 'open_window', 
          'menubar, toolbar, location, 
          directories, status, scrollbars, 
          resizable, dependent, width=640, 
          height=480, left=0, top=0') 

} 

它的工作正常。

但是,當我更改了網址並保存了我的代碼並刷新了頁面後,再次調用該函數,但它並未在新窗口中打開,它刷新了之前打開的窗口。

我想讓我的新鏈接在另一個新窗口中打開,而不是相同。

我該怎麼做?

回答

4

您給打開窗口的名字open_window與您的示例相關聯,以便您可以重新使用它。

如果您想要打開一個新窗口,請指定一個新名稱,或者撥打_blank以始終打開一個新窗口。

我努力找到一個來源來驗證這一點,但它是explained on this page