[PHP] Re: Works in html, not when echoed in PHP

2002-11-13 Thread David Robley
In article [EMAIL PROTECTED], [EMAIL PROTECTED] says...
 Folks,
 
 Can't see an answer anywhere in the archives, so here goes.
 
 This 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
 
 The onoff() function is what contains the menuObj, so I suspect the single
 quotes around the parameters mainmenu and on, but have tried everyway I can
 think of and can't get rid of the Error.
 
 The function is thus:
 
 function onoff (elemparent,elem,state) {
 if (loaded) {
 newstate = eval(elem+_+state);
 if (n4) {
 menuObj = eval (doc + elemparent + doc2 + elem);
  }
 else if (ie || n6) {
 menuObj = eval (doc + elem + doc2);
  }
 
 I would be grateful for any tips.

Not a JS expert, but: have you tried comparing the 'View source' of your 
PHP script output with the expected code?

Cheers
-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: Works in html, not when echoed in PHP

2002-11-13 Thread Javier Montserat

rather than using echo why not just do this -

?
body onload=start();initialize();onoff('mainmenu',section,'on')
onresize=window.location.reload(false) topmargin=1 bottommargin=0 
leftmargin=0 rightmargin=0
?

this way you don't have to worry about getting the quotes right...



Hello,

Aaron Merrick [EMAIL PROTECTED] wrote:

Folks,

Can't see an answer anywhere in the archives, so here goes.

This 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

The onoff() function is what contains the menuObj, so I suspect the single
quotes around the parameters mainmenu and on, but have tried everyway I

can

think of and can't get rid of the Error.

The function is thus:









_
Add photos to your e-mail with MSN 8. Get 2 months FREE*. 
http://join.msn.com/?page=features/featuredemail


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php