简体   繁体   English

Window.open在另一个弹出窗口中不起作用

[英]Window.open not working in another pop up window

I have a popup window 'X' generated using javascript window.open() . 我有一个使用javascript window.open()生成的弹出窗口“ X”。 When I try to open another child window 'Y' from the pop-up window 'X', i have getting a pop up window 'Y' and also the url of the 'X' reloading to the orignial browser window. 当我尝试从弹出窗口“ X”打开另一个子窗口“ Y”时,我得到一个弹出窗口“ Y”,并且还将“ X”的网址重新加载到原始浏览器窗口中。 Can any one please help me with this? 有人可以帮我吗?

I try with this one and it worked for me: 我尝试了这个,对我有用:

function openWin()
{
myWindow=window.open('','','width=200,height=100');
myWindow.document.write("<button class='hi' onclick='window.open()'> hi!</button>");
myWindow.focus();
}
<input type="button" value="Open window" onclick="openWin()" />

This may be you have not return false when opening other child window Y from the pop up X window. 这可能是您从弹出的X窗口打开另一个子窗口Y时没有return false So your browser is reloading. 因此,您的浏览器正在重新加载。 Try this if still not work post your script if possible! 如果仍然无法尝试,请尝试此操作,如果可能的话,发布您的脚本!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM