Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/74.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/rust/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 超链接打开是单独的窗口_Javascript_Html_Hyperlink - Fatal编程技术网

Javascript 超链接打开是单独的窗口

Javascript 超链接打开是单独的窗口,javascript,html,hyperlink,Javascript,Html,Hyperlink,我使用js代码在新窗口中打开了一个超链接 function openNewWindow() { alert("hello"); var theurl="http://www.google.com"; popupWin = window.open(theurl, 'open_window', 'menubar, toolbar, location, directori

我使用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')

}
它工作得很好

但是,当我更改了url并保存了代码并刷新了页面,然后再次调用该函数时,它不会在新窗口中打开,而是刷新了以前打开的窗口

我希望我的新链接在另一个新窗口中打开,而不是在同一个窗口中


如何执行此操作?

在您的示例中,您为打开的窗口指定的名称,
open\u window
与该窗口关联,以便您可以重复使用它

如果要打开一个新窗口,请给它一个新名称,或
\u blank
始终打开一个新窗口

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')

}

我很难找到一个源代码来验证这一点,但它是。

在您的示例中,您为打开的窗口指定的名称,
open\u window
与该窗口关联,因此您可以重复使用它

如果要打开一个新窗口,请给它一个新名称,或
\u blank
始终打开一个新窗口

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')

}
我很难找到一个来源来证实这一点,但它是