View Full Version : problem launching two pop ups!

05-06-2004, 01:46 AM
I am having problems launching two pop up windows. I must be doing something wrong here and I cannot figure it out with all the forum searches and help sites. the script I have works in launching the first pop-up but not the second one. Any suggestions?

The script is as follows;

<script LANGUAGE=JavaScript1.1 type="text/javascript">
function nw() {
var sw = screen.width;
var sh = screen.height;
var wh = 400;
var ww = 900;
var wx = (sw-ww)/2;
var wy = (sh-wh)/2;
window.open('index2.html','Lunds','height='+wh+',width='+ww+',top='+wy+',left='+wx+',toolbar=no,menu bar=no,status=no,scrollbar=no,resizable=no,minimize=no,maximize=no');
function invite() {
window.open('invite.html','Lunds','height=400,width=400,toolbar=no,menubar=no,status=no,scrollbar=no ,resizable=no,minimize=no,maximize=no');

<body bgcolor="white" onLoad="nw();" onLoad="invite();">

05-06-2004, 02:23 AM
you cant have two onloads like that, change <body bgcolor="white" onLoad="nw();" onLoad="invite();"> to
<body bgcolor="white" onLoad="nw(); invite();">

05-06-2004, 08:52 AM

window.onload=function(){nw(); invite()}

Roy Sinclair
05-06-2004, 04:48 PM
Another problem will still prevent this from working. Once of the parameters you pass to the window.open function is the name of the new window. Once a window is named, any more references to that window name will also use that exact same window. Since both of your window.open calls use the same name then the first window is being opened and then when the second window.open call is processed it's trying to open that in the same window. Change the window name in one of those two calls and you'll get two popups.