PDA

View Full Version : multiple window pop ups


firemonkey
10-16-2002, 10:35 AM
hello

i have a html page with a onload event. i'm using JS to pop up a window to a specific size/position. this works fine, but then when i try and repeat the process with a second pop up the 2nd pop up replaces the 1st (in the position specified for the 1st pop up)

what i would like to know: how do i pop up 2 windows from a html file... both with their own position/size/content.

i've attached a sample of my source code...

thanks for your help
christiaan

tommysphone
10-16-2002, 12:39 PM
why not have the first popup reload a new page once loaded, say after a set time. That way its only one popup but many events for each version of it.

Barry
10-30-2002, 01:29 PM
Hi christiaan

Did you find a solution to the multiple window opening. I have the same problem. The suggested reload method will not work for me.

Barry

PauletteB
10-30-2002, 02:25 PM
Change the second target name to whatever, eg my2window.

Barry
10-30-2002, 02:38 PM
Hi Pauletteb

I have a partial solution and a question here.

http://www.codingforums.com/showthread.php?s=&threadid=7639&highlight=barry


thanks

Barry

PauletteB
10-30-2002, 03:44 PM
If I read the question right;
open another window from within the pop-up.

currently the 2nd or subsequent window disappears each time the link is clicked
that's what is supposed to happen.

By using
<BODY onBlur="self.focus()"> in the pop-up, that window will stay on top. May not work on multiple instances.

Barry
10-30-2002, 04:48 PM
sorry I am unclear I am having a problem descriping what I need.
Trying again.

What I want to do is click on different href statements in a page and have them open and leave open different windows.

url 1 opens window 1
url 2 opens window2
on so on.

The code that is shown does not have a way to pass the desired window url to the script. I want to have only one copy of the script.



Barry

Barry
10-30-2002, 06:41 PM
Found the solution using this script.

<html>
<head>

<script language="JavaScript">
<!-- hide from JavaScript-challenged browsers

function openAnyWindow(url, name) {

// store number of arguments passed in
var l = openAnyWindow.arguments.length;

// initialize w (width)
var w = "";
// initialize h (height)
var h = "";
// initialize features (comma-delineated list of window features)
var features = "";

// loop through array of arguments to build list of features
// begin loop with 2 (third element of array) to skip url and name
for (i=2; i<l; i++) {

// store current argument in variable param
var param = openAnyWindow.arguments[i];

// if param isn't a number, it's not width or height
// in that case, append to features with comma
if ( (parseInt(param) == 0) || (isNaN(parseInt(param))) ) {
features += param + ',';

// else param is a number; must be width or height
} else {

// if w hasn't been set yet, param must be the width
// otherwise, w has been set, so param must be the height
(w == "") ? w = "width=" + param + "," : h = "height=" + param;
}
}

// append width and height strings to list of features
features += w + h;

// begin building statement to open window
var code = "popupWin = window.open(url, name";

// if l>2, there were more than two arguments
// in that case, append comma, parenthesis, and list of features
if (l > 2) code += ", '" + features;

// finish building statement to open window
code += "')";

// execute statement to open window
eval(code);
}

// done hiding -->
</script>
</head>



<body>

<a href="javascript:openAnyWindow('test1.htm', 'windowa', 700, 500, 'resizable=yes', 'toolbar=yes', 'scrollbars=yes', 'location=yes', 'status=yes');">
test</a>

<a href="javascript:openAnyWindow('test2.htm', 'windowb', 700, 500, 'resizable=yes', 'toolbar=yes', 'scrollbars=yes', 'location=yes', 'status=yes');">
test</a>

</body>
</html>


Use windowc and so on etc for additional href's

Barry