Append function to onLoad

Discussion in 'Javascript' started by Steve Macleod, Oct 1, 2006.

  1. Hi,
    I am writing a function which will be included on other pages. I need
    to append a function call to the body onload event without disrupting
    other function calls which may/may not be there. Does anyone know how
    to achieve this?
     
    Steve Macleod, Oct 1, 2006
    #1
    1. Advertising

  2. Steve Macleod

    Guest

    Hello Steve!

    Check this url: http://www.dustindiaz.com/top-ten-javascript

    You will find what you are looking for.


    Hugo Madureira


    Steve Macleod wrote:
    > Hi,
    > I am writing a function which will be included on other pages. I need
    > to append a function call to the body onload event without disrupting
    > other function calls which may/may not be there. Does anyone know how
    > to achieve this?
     
    , Oct 1, 2006
    #2
    1. Advertising

  3. Steve Macleod

    Evertjan. Guest

    Steve Macleod wrote on 01 Oct 2006 in comp.lang.javascript:

    > I am writing a function which will be included on other pages.


    Other?

    Oh you mean in an include file.

    > I need
    > to append a function call to the body onload event without disrupting
    > other function calls which may/may not be there. Does anyone know how
    > to achieve this?
    >


    will this help?

    ======= test.html ===============
    <body onload="alert('a');">

    <script type='text/javascript'>

    function b(){
    alert('b');
    };

    var x = window.onload
    window.onload = function(){b();x();}

    </script>
    ==================================


    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
     
    Evertjan., Oct 1, 2006
    #3
  4. Yeah that is it!
    simple really, I guess. Must have been at this too long!

    Thanks for the help!
     
    Steve Macleod, Oct 1, 2006
    #4
  5. Steve Macleod

    Evertjan. Guest

    Steve Macleod wrote on 01 Oct 2006 in comp.lang.javascript:

    > Yeah that is it!
    > simple really, I guess. Must have been at this too long!
    >


    Sorry, What are you talking about?

    On usenet please always quote, usenet is not email.

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
     
    Evertjan., Oct 1, 2006
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Fabio R.
    Replies:
    0
    Views:
    820
    Fabio R.
    Mar 25, 2005
  2. HYRY
    Replies:
    10
    Views:
    625
    Bruno Desthuilliers
    Sep 26, 2007
  3. David Otton

    window.onload and body.onload differences

    David Otton, Nov 4, 2004, in forum: Javascript
    Replies:
    2
    Views:
    585
    Martin Honnen
    Nov 4, 2004
  4. Replies:
    5
    Views:
    282
    Thomas 'PointedEars' Lahn
    May 15, 2005
  5. marco

    onload -->* no onload

    marco, Jun 22, 2006, in forum: Javascript
    Replies:
    7
    Views:
    214
    marco
    Jun 24, 2006
Loading...

Share This Page