window.open 不打开窗口

Dar*_*ney 3 html javascript window.open

我试图在弹出窗口中打开页面,而不是在新选项卡中打开页面 - 但无论我尝试使用哪种浏览器,都会在新选项卡中打开页面,而不是弹出窗口。

<input type="button" value="new win" onclick="window.open('http://yahoo.com', 'width=500, height=400')"  />
Run Code Online (Sandbox Code Playgroud)

有什么理由吗?

Ale*_*lex 6

第二个参数必须是窗口名称:

<input type="button" value="new win" 
    onclick="window.open('http://yahoo.com', 'mywindow', 'width=500, height=400')"  />
Run Code Online (Sandbox Code Playgroud)

在 Chrome 和 Firefox 中工作正常:

http://jsfiddle.net/DvMy5/2/