Click to See Complete Forum and Search --> : popup with different sizes on the same html?
drtopo
11-23-2002, 10:28 AM
So, I have this script to open popup window with a specified size:
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=1,menubar=0,resizable=1,width=800,height=600,left = 10,top = 10');");
}
// End -->
</script>
So this open a page of 800x600 but what if I also want another link (in the same html page) to open a different sized window...
thanks
Charles
11-23-2002, 10:37 AM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Content-Script-Type" content="text/javascript">
<title>Window Example</title>
<p><a href="http://www.w3.org/" onclick="window.open(this.href, '', 'height=400,width=300'); return false">The W3C</a></p>
And see http://developer.netscape.com/docs/manuals/js/client/jsref/window.htm#1202731 for more details.
Beach Bum
11-23-2002, 10:48 AM
there must be more to your question than i am understanding. but . . . in your example you say you want another link to open another size window. then have the other link call another function (for example popUp2) with a different size window. you can have as many functions as you want. each link can point to a different function.
if you are asking how to dynamically change that single window open function with different window sizes, then you would need to define a variable with the size you want and replace the actuial values in your statement with the variables.
am i answering your question?
drtopo
11-23-2002, 11:19 AM
Thanks Beach Bum,
sorry if I wasn't clear enough, but you answered my question.
I didn't know you could call a funcion popUp2, popUp3, etc.
This really help.
take care.
gil davis
11-23-2002, 01:50 PM
Originally posted by drtopo
...but what if I also want another link (in the same html page) to open a different sized window...
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function popUp(URL,wd,ht) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=1,menubar=0,resizable=1,width=' + wd + ',height=' + ht + ',left = 10,top = 10');");
}
// End -->
</script>
Call it like this:
<a href="someURL.htm" onClick="popUp(this.href,800,600);return false">
<a href="otherURL.htm" onClick="popUp(this.href,640,480);return false">
One function, no waiting...
Zach Elfers
11-23-2002, 02:13 PM
The simplest way would be to make a new function that is exactly the same as the one you already have but has a different size.:)