Javascript 每次函数调用都会出现一个新的弹出窗口
我试图编写一个函数,在每次调用中打开一个新窗口。实际上,它创建了第一个窗口,当我再次调用该函数时,它不会打开新的弹出窗口,而是重新加载第一个窗口:Javascript 每次函数调用都会出现一个新的弹出窗口,javascript,popup,window.open,Javascript,Popup,Window.open,我试图编写一个函数,在每次调用中打开一个新窗口。实际上,它创建了第一个窗口,当我再次调用该函数时,它不会打开新的弹出窗口,而是重新加载第一个窗口: function openNewWindow(title, url){ var newWindow = window.open('about:blank', '', 'toolbar=0, status=0, scrollbars=1, width=500, height=500');
function openNewWindow(title, url){
var newWindow = window.open('about:blank', '',
'toolbar=0, status=0, scrollbars=1, width=500, height=500');
var html = '<html><head><title>'+title+'</title></head>'
+ '<body><iframe src="'+url+'" width="100%" height="100%"></iframe>'
+ '</body></html>';
newWindow.document.write(html);
newWindow.document.close();
}
函数openNewWindow(标题、url){
var newWindow=window.open('about:blank','',
‘工具栏=0,状态=0,滚动条=1,宽度=500,高度=500’;
var html=''+title+''
+ ''
+ '';
newWindow.document.write(html);
newWindow.document.close();
}
我曾尝试将新窗口引用存储在数组中,但效果不理想。我不能使用像jQuery这样的库。你知道实现这一目标的方法吗
谢谢 使用
\u blank
作为窗口名(第二个参数用于open()
)您应该发布您尝试过的代码,数组似乎是最简单的方法查看窗口中的第二个参数。open methodOops,很抱歉我错过了,非常感谢