...

View Full Version : Popup window each has own size



DreamHack497
02-11-2009, 01:19 AM
Hi, i am having a problem with javascript. I have a page with a bunch of links on it, and whenever someone clicks on link i want it to popup, but each popup to have its own size, instead of a fixed size.
Im not sure where to start or what to change, please help.


<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function Help(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=200,height=300,left = 290,top = 100');");
}
// End -->
</script>
?>

<a href="JavaScript:Help('link.php');">Link</a>

snowieken
02-11-2009, 01:26 AM
Can't you pass the desired width and height of the popup along with the url as parameters to the function?

So the function would be "Help(URL,width,height)" and the popup code adjusted according to that?

DreamHack497
02-11-2009, 01:36 AM
Thanks, but no it didn't work.


<a href="JavaScript:Help('index.php,500,50');">Link</a>

and wasnt sure how to properly edit the popup script.


EDIT: Thanks anyways, but tried this (see next line) and it worked without having to use a separate script:

<A HREF="javascript:void(0)" onclick="window.open('welcome.html','welcome','width=400,height=300')">Link</A>

snowieken
02-11-2009, 01:48 AM
If you don't need other code to be executed, only the popup window, yes, that works. :thumbsup:

For future reference, if you want to pass more parameters to a function, do it the following way:


<a href="javascript:Help('index.php','500','50');">Link</a>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum