Page 1 of 1
Creating link that opens in a re-sized window
Posted: Mon Jan 27, 2003 1:27 pm
by nigma
I have a page that I am working on, its a form, but it doesn't take up the whole page. So it looks real corny when it takes up 1/4 of a page and the rest is just background. Is there an easy way in php/html/javascript to make a link open in a window that resizes based on content?
Posted: Mon Jan 27, 2003 1:35 pm
by puckeye
Hi nigma,
Unfortunately there's no easy way to resize a window based on text and form elements. You'll have to guess the window size and use the JavaScript window.open () function accordingly.
Can I suggest to design nice images that'll go around your form and "dress up" the rest of the page?
Posted: Mon Jan 27, 2003 1:38 pm
by nigma
What about an easy way to assign the window size(using php)?
I dont have a prob doing it in javascript but since I am trying to learn php thought it would be more productive if I used that.
Posted: Mon Jan 27, 2003 1:48 pm
by puckeye
Hi again,
AFAIK PHP doesn't have any way to correctly guess the width and height that text and form components will take.
Also PHP doesn't affect window size in any way because all PHP parsing is done before the users even receives the page on his/her browser.
The only way that PHP could remotely assign a wdith and height is that if you create a pop-up to show an image, PHP can get the correct w/h using getimagesize() and then could "pass" those values to JavaScript in a way similar to this:
Code: Select all
print "
<SCRIPT>
window.open = ("file", "name", "height=$height,width=$width");
</SCRIPT>
";
PHP isn't actually passing anything to JavaScript it's just writing the JavaScript code and adding the appropriate value at the appropriate place.
EDIT: Corrected the function name get_image_size() to getimagesize()
Posted: Mon Jan 27, 2003 5:21 pm
by nigma
Thank for the help.