[KLUG Members] Opening a popup with Java Script

bill bill at billtron.com
Tue Jun 21 10:24:06 EDT 2005


On Tue, 2005-06-21 at 09:10, Adam Tauno Williams wrote:
> DOH! DOH! DOH! DOH! DOH! DOH! DOH! DOH! DOH! DOH! Doh! Doh! Doh! Doh!
> Doh! doh! doh! doh. doh.
> 
> It appears it was a *(^&R&*#T)@*F)@G quoting problem.
> 
> $popUpUrl = sprintf('http://throw/hedera/popup.php?user=%s&company=%
> d&question=%d', $_GET['login'], $_GET['objectid'], 1);
> echo "<A HREF=\"javascript:void(0)\" onClick=
> \"return(window.open('$popUpUrl', 'Hedera: Edit Response',
> 'widgth=432,height=270,toolbar=0,scrollbars=0'));\">Edit
> Response</A><BR>";
> echo "<form><input type=button value=\"Edit Response\" onClick=
> \"return(window.open('$popUpUrl', 'Hedera: Edit Response',
> 'widgth=432,height=270,toolbar=0,scrollbars=0'));\"></form>";
> 
> Either of the above work.  If you escape the single quotes in the
> javascript it doesn't work,  and if you use escaped double quotes it
> doesn't work.  Neither does it winge, cry, or complain.

In PHP, there is no need to escape single quotes inside a double quoted
string.

echo "I don't need to escape any 'single quotes' here";

This is true even if you're using variables

$sql="INSERT INTO mytable
(field1, field2, field3) 
VALUES ('$val1','$val2','$val3')";

With Javascript, use View/Source on the browser window to check the
code.  Note: some browsers attempt to "fix" the source code, making it
tough to find your errors.  Hence the javascript window is helpful.

BTW, "widgth" has been substituted for "width" 2x above.  There is no
"widgth" attribute, unless it married a widget. :-)

> Now to get the child window to tell the parent window to refresh when it
> closes and I'm in business.

Haven't tried that, but have you tried an onClose (parent.refresh()) or
something similar in the popup window?

kind regards,

bill



More information about the Members mailing list