Popup window size.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
facets
Forum Contributor
Posts: 273
Joined: Wed Apr 13, 2005 1:53 am
Location: Detroit

Popup window size.

Post by facets »

Hi All,

Any chance someone may point me int he right direction.
I've added window size onto the javascript window popup and it's stopped the popup being executed. ANy ideas?

tia, Will.

Code: Select all

function view($stockId) {
    echo "<script language=\"javascript\">var newWindow = window.open('".$_SERVER['PHP_SELF']."?action=view_record&stockId=".$stockId." + \"scrollbars=yes,status=yes,WIDTH=350,height=350\"')></script>";
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

your options are in the URL argument.
facets
Forum Contributor
Posts: 273
Joined: Wed Apr 13, 2005 1:53 am
Location: Detroit

Post by facets »

sure. I kind of gathered that, but am unsure on how to format the code correctly. is the following closer? (It doesn't act correctly though :)

Code: Select all

echo "<script language=\"javascript\">var newWindow = window.open('".$_SERVER['PHP_SELF']."?action=view_record&stockId=".$stockId."' + \"scrollbars=yes,status=yes,WIDTH=350,height=350\")</script>";
would it be more efficient to merge the following ?

Code: Select all

// Set Up viewDetails
   } elseif ($_POST['stockId']) {
       view($_POST['stockId']);
//       echo "<a href=\"javascript:open_window('".$_SERVER['PHP_SELF']."?action=view_record&stockId=".$stockId."')\">View</a>";
   }

// Pop up function
function view($stockId) {

//echo "<a href=\"javascript:open_window('".$_SERVER['PHP_SELF']."?action=view_record&stockId=".$stockId."')\">View</a>";

echo "<script language=\"javascript\">var newWindow = window.open('".$_SERVER['PHP_SELF']."?action=view_record&stockId=".$stockId."' + \"scrollbars=yes,status=yes,WIDTH=350,height=350\")</script>";
}
tia, Will
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

a plus (between strings) concatenates in Javascript. It doesn't seperate arguments.
facets
Forum Contributor
Posts: 273
Joined: Wed Apr 13, 2005 1:53 am
Location: Detroit

Post by facets »

Ok. i've tried a comma, and '&' and ;
None of them work.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

facets
Forum Contributor
Posts: 273
Joined: Wed Apr 13, 2005 1:53 am
Location: Detroit

Post by facets »

AHHH!. Thank you. Missing the name.
I was unaware that you need all the attributes to form a correctly coded popup.
javascript 101 I guess :)

here's my output :

Code: Select all

echo "<script language=\"javascript\">var newWindow = window.open('".$_SERVER['PHP_SELF']."?action=view_record&stockId=".$stockId."','','scrollbars=yes,status=yes,WIDTH=350,height=350')</script>";
many thanks for you patience and assistance.
tia, will
Post Reply