Results 1 to 2 of 2

Thread: Javascript OnLoad Function

  1. #1
    Join Date
    Apr 2010
    Location
    Moschato, Athens, Greece
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question Javascript OnLoad Function

    Hello,

    I have one javascript named george.js
    At the bottom of javascript i have that code
    Code:
    var previousOnload = window.onload;
    window.onload = function () { alert('into george javascript'); if(previousOnload) previousOnload(); dogeorgemainfunction(); }
    _

    I have another javascript named stella.js
    At the bottom of javascript i have that code
    Code:
    var previousOnload = window.onload;
    window.onload = function () { alert('into stella javascript');  if(previousOnload) previousOnload(); dostellamainfunction(); }
    _

    At my page i have add:
    Code:
    <script type="text/javascript" src="clientscript/george.js"></script>
    <script type="text/javascript" src="clientscript/stella.js"></script>
    _

    I aslo have
    Code:
    <body onload="$onload">
    _
    in the same page

    But when the page open run only the one of the two onload........
    What i have to do to run the onloads from the two javacripts???

    (I check only first and work perfect, then i check only second and work perfect, when i have together go only to one javascript onload)

    waiting your help

    Thanks In Advance
    SorentoUltimate

  2. #2
    Join Date
    Dec 2008
    Location
    Portsmouth, UK
    Posts
    1,821
    Thanks
    2
    Thanked 425 Times in 419 Posts

    Default

    remove the body onload

    and

    Code:
    <script type="text/javascript">
    window.onload=function(){
     dogeorgemainfunction();
     dostellamainfunction();
    }
    		</script>
    or at the bottom of the page

    Code:
    <script type="text/javascript">
     dogeorgemainfunction();
     dostellamainfunction();
    </script>
    Vic
    God Loves You and will never love you less.
    http://www.vicsjavascripts.org/Home.htm
    If my post has been useful please donate to http://www.operationsmile.org.uk/

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •