PHP and Javascript

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Angelos

    PHP and Javascript

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

    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="loadMen u()"> 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 ?



  • micha

    #2
    Re: PHP and Javascript

    "Angelos" <angelos@redcat media.net> wrote in
    news:d5vgu6$3lj $1@nwrdmz02.dmz .ncs.ea.ibs-infra.bt.com:
    [color=blue]
    > Hello there,
    > I have the folowing problem:
    > I need to use the <body onload="loadMen u()";"initDocum ent()"> but the
    > first javascript "loadMenu() " is in menu.php and initDucument() is in
    > content.php.
    >
    > 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="loadMen u()"> 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 ?
    >
    >
    >
    >[/color]

    what exactly doesn't work?

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

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

    print '<body onload="loadMen u()";"initDocum ent()">';

    there?

    micha

    Comment

    • frizzle

      #3
      Re: PHP and Javascript

      Yo have too many "-signs
      it should be

      onload="loadMen u(); initDocument()"

      Comment

      • Ewoud Dronkert

        #4
        Re: PHP and Javascript

        On Thu, 12 May 2005 12:07:34 +0000 (UTC), Angelos wrote:[color=blue]
        > <body onload="loadMen u()";"initDocum ent()">[/color]

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

        Try <body onload="loadMen u();initDocumen t()">


        --
        Firefox Web Browser - Rediscover the web - http://getffox.com/
        Thunderbird E-mail and Newsgroups - http://gettbird.com/

        Comment

        • Tony

          #5
          Re: PHP and Javascript

          "Angelos" <angelos@redcat media.net> wrote in message
          news:d5vgu6$3lj $1@nwrdmz02.dmz .ncs.ea.ibs-infra.bt.com...[color=blue]
          > Hello there,
          > I have the folowing problem:
          > I need to use the <body onload="loadMen u()";"initDocum ent()"> but the
          > first javascript "loadMenu() " is in menu.php and initDucument() is in
          > content.php.
          >
          > 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="loadMen u()"> 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 ?[/color]

          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="javas cript">
          loadMemu();
          initDocument();
          </script>


          Comment

          Working...