PHP and Javascript

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

Hello there,
I have the folowing problem:
I need to use the <body onload="loadMenu()";"initDocument()"> but the first
javascript "loadMenu()" is in menu.php and  initDucument() is in

Now Non of these php files has a body tag in order to add the onload
Javascritp because I use a header.php and a footer.php which is included in
each php document.

I succesfully use the <body onload="loadMenu()"> in my header.php but if I
add the initDocument(). It won't work....

Does any of you ever did something similar and is able to give me a hint ?

Re: PHP and Javascript

Quoted text here. Click to load it

what exactly doesn't work?

let's suppose this is not a javascript problem (i.e. both function work

as far as i can understand header.php actually outputs the <body> tag.
why not

print '<body onload="loadMenu()";"initDocument()">';



Re: PHP and Javascript

Yo have too many "-signs
it should be

onload="loadMenu(); initDocument()"

Re: PHP and Javascript

On Thu, 12 May 2005 12:07:34 +0000 (UTC), Angelos wrote:
Quoted text here. Click to load it

First of all, this has nothing to do with php.
Second, go read some html/dom documentation.

Try <body onload="loadMenu();initDocument()">

Firefox Web Browser - Rediscover the web - /
Thunderbird E-mail and Newsgroups - /

Re: PHP and Javascript

Quoted text here. Click to load it

Don't include it in the <body> tag. JavaScript within the body will execute
upon loading. So, at the top of your content page (after the header that has
the <body> tag), put:

<script language="javascript">

Site Timeline