gpt4 book ai didi

javascript - window.open 不打开窗口

转载 作者:太空宇宙 更新时间:2023-11-04 14:05:22 29 4
gpt4 key购买 nike

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

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

有什么原因吗?

最佳答案

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

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

在 Chrome 和 Firefox 中运行良好:

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

关于javascript - window.open 不打开窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12912690/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com