Forum Moderators: open
I use this function to open a popup:
function openPopup(url,width,height)
{
window.open(url,"Game","width="+width+",height="+height+",status=no,menubar=no,toolbar=no,scrollbars=no,screenX=20,screenY=20,top=20,left=20,resizable=no");
}
And these links to execute:
<a href="javascript:openPopup('game01.htm','256','256');">Game 01</a>
<a href="javascript:openPopup('game02.htm','256','256');">Game 02</a>
<a href="javascript:openPopup('game03.htm','256','256');">Game 03</a>
...the thing is, I can only have one window open at a time. So if I click the first link (Game 01) it's fine, but when I click the second link it opens in the Game 01 window.
How do I make it so I can have multiple windows open?
Thanks.
function openPopup(url,winName,width,height)
{
window.open(url,winName,"width="+width+",height="+height+",status=no,menubar=no,toolbar=no,scrollbars=no,screenX=20,screenY=20,top=20,left=20,resizable=no");
}
<a href="javascript:openPopup('game01.htm','window1','256','256');">Game 01</a>
<a href="javascript:openPopup('game02.htm','window2','256','256');">Game 02</a>
<a href="javascript:openPopup('game03.htm','window3','256','256');">Game 03</a>
function openPopup(url,width,height) {
var day = new Date();
var id = day.getTime();
window.open(url,id,"width="+width+",height="+height+",screenX=20,screenY=20,top=20,left=20);
return false;
}
<a href="game1.htm" onClick="return openPopup('game01.htm','256','256');">Game 01</a>
<a href="game2.htm" onClick="return openPopup('game02.htm','256','256');">Game 02</a>
<a href="game3.htm" onClick="return openPopup('game03.htm','256','256');">Game 03</a>
Note I've removed all the "no" 's - you don't need to specify no if you don't want an attribute. You only need to specify it if you want it.