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
facets
Forum Contributor
Posts: 273 Joined: Wed Apr 13, 2005 1:53 am
Location: Detroit
Post
by facets » Mon Apr 18, 2005 10:42 pm
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>";
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Mon Apr 18, 2005 11:13 pm
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 » Mon Apr 18, 2005 11:21 pm
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
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Tue Apr 19, 2005 12:07 am
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 » Tue Apr 19, 2005 12:19 am
Ok. i've tried a comma, and '&' and ;
None of them work.
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Tue Apr 19, 2005 12:30 am
facets
Forum Contributor
Posts: 273 Joined: Wed Apr 13, 2005 1:53 am
Location: Detroit
Post
by facets » Tue Apr 19, 2005 12:37 am
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