Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automatic resize of a popup window

Status
Not open for further replies.

milams

Programmer
May 28, 2004
32
US
Is there a way to automatically size a popup window based on the the size of the table? I am querying the table dimesions using PHP and MySQL and I would like to insert the two variables $alt_height and $alt_width into the javascript code below by putting those two variables in place the pixel height and width dimensions. Is this possible?

<script language= JavaScript><!--
function pop1(URL) {
window.open(URL,'','height=500,width=730,scrollbars=no,top=05,left=10');
} //-->;
</script>

If anybody can help I would really appreciate it.
 
Are you querying the database from the popup window? If so, I suggest you open the window with the default settings you have there.

The popup window will query the db and build your webpage. Then, afterwards, you can reference the height of the data it has written, and use the window's resizeTo() function to, at THAT point, change the height / width of the popup.

*cLFlaVA
----------------------------
Lois: "Peter, you're drunk!"
Peter: "I'm not drunk, I'm just exhausted from stayin' up all night drinking!
 
No, I'm quering the dabase from the main page where the popup link is. that script from before is from the main page. But, in PHP the fields are present on the main page, so I thought i could do this, but it doesn't work

<?php
echo "<script language= JavaScript>"; echo "<!--
function pop1(URL) {
window.open(URL,'','height=$tbl-height,width=$tbl_width,scrollbars=no,top=05,left=10');
} //-->;";
echo "</script>";
?>
 
If that doesn't work (but it looks like it should), try
Code:
<script language="JavaScript">
<!--
function pop1(URL) {
window.open(URL,'','height=<? =$tbl-height ?>,width=<?= $tbl_width ?>,scrollbars=no,top=05,left=10');
} 
//-->;
</script>

--Chessbot

"See the TURTLE of enormous girth!"
-- Stephen King, The Dark Tower series
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top