Re: Works in html, not when echoed in PHP
| From: | Chris Shiflett | Date: | Wed, 13 Nov 2002 06:52:48 +0000 |
| Subject: | Re: Works in html, not when echoed in PHP | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-124170@lists.php.net to get a copy of this message | ||
@ Edwin wrote:
"Aaron Merrick" <amerrick@mac.com> wrote:Or better yet, try this: <body onload="start();initialize();onoff('mainmenu',section,'on')" onresize="window.location.reload(false)" topmargin="1" bottommargin="0" leftmargin="0" rightmargin="0"> Yes, this is the same code that "works fine in plain html". Why echo it in PHP if it is static? ChrisThis works fine in plain html: <body onload="start();initialize();onoff('mainmenu',section,'on')" onresize="window.location.reload(false)" topmargin="1" bottommargin="0" leftmargin="0" rightmargin="0"> When I put it in PHP thus: echo "<body onload=\"start();initialize();onoff('mainmenu',section,'on')\" onresize=\"window.location.reload(false)\" topmargin=\"1\" bottommargin=\"0\" leftmargin=\"0\" rightmargin=\"0\">"; When the page loads, I get an "Error: 'menuObj' is null or not an object"I think php is parsing your js code. Have you tried echoing with single quotes? echo '<body onload="start();initialize();onoff(\'mainmenu\',section,\'on\')" onresize="window.location.reload(false)" topmargin="1" bottommargin="0" leftmargin="0" rightmargin="0">';