At 2/3/2007 12:44 PM, Chris Carter wrote:
I am trying to open a Java script pop up widow from within the php code. Not
able to get it done, the error I think is in the use of "" '' .. I mean
double and/or single quote. Do not know how to place those. Please advice.
The code is below:
echo "
<tr>
<td>$shopname </td>
<td>$category </td>
<td>$subcategory </td>
<td>$level </td>
<td> javascript:poptastic( Details </td>
</tr>";
That last table cell is deeply troubled. First, you're missing a
close-parenthesis and semi-colon, should be:
javascript:poptastic( Details );
Second, this is going to output to HTML as plain text, not as
executable script. Perhaps you meant to embed the function call in an anchor?
<a href="javascript:poptastic( Details );">link text</a>
Third, when do you expect this pop-up window to pop up? Are you
aware that PHP executes on the server, then downloads the page to the
client, then the client processes any embedded javascript and
executes it? Perhaps this sequence of events would be more clear if
you used the window.onload event to trigger the pop-up.
Fourth, are you aware that many browsers are set to suppress
pop-ups? If your page depends on pop-ups, it will break or be
rendered non-functional by pop-up suppression.
The javascript code works perfect with other pages and within HTML, its just
that the PHP is not supporting the quotes and double quotes. I have even
tried &rsquo &rdquo and all.
Don't use curly quotes in scripting; that's just for text display.
I don't see that quotation marks are a problem in the script you've
posted, but maybe you haven't given us an accurate copy of the whole thing.
If quotes are a problem, try using heredoc:
http://php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc
echo <<<_
This text doesn't "care" about quotes.
_;
Regards,
Paul
__________________________
Paul Novitski
Juniper Webcraft Ltd.
http://juniperwebcraft.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php