Page 1 of 1

Popup window size.

Posted: Mon Apr 18, 2005 10:42 pm
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>";

Posted: Mon Apr 18, 2005 11:13 pm
by feyd
your options are in the URL argument.

Posted: Mon Apr 18, 2005 11:21 pm
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

Posted: Tue Apr 19, 2005 12:07 am
by feyd
a plus (between strings) concatenates in Javascript. It doesn't seperate arguments.

Posted: Tue Apr 19, 2005 12:19 am
by facets
Ok. i've tried a comma, and '&' and ;
None of them work.

Posted: Tue Apr 19, 2005 12:30 am
by feyd

Posted: Tue Apr 19, 2005 12:37 am
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