www.webdeveloper.com
Results 1 to 4 of 4

Thread: Need Help with OnLoad Function

  1. #1
    Join Date
    Feb 2010
    Posts
    12

    Need Help with OnLoad Function

    I cannot figure out how to make both of my onLoad functions work within my web page. One is embedded in the Javascript code (within head) and the other is placed in the Body command. I don't know Javascript at all, so I'll have to link you to the page so that you can view the code. Any assistance is appreciated!
    Link
    Thanks.
    ~Leanne

  2. #2
    Join Date
    Aug 2007
    Posts
    3,767
    It's one or the other. Put both in the head.
    Code:
    window.onload = function () {
    function1();
    function2();
    };

  3. #3
    Join Date
    Feb 2010
    Posts
    12

    Still unsure

    So I understand now that I can't give both commands but how exactly shoud I combine the two. Like I said I'm new with Javascript.
    Thanks so much!

  4. #4
    Join Date
    Feb 2010
    Posts
    12

    Would This Work?

    <script type="text/javascript">
    // <![CDATA[
    var myMenu;
    window.onload = function() {
    myMenu = new SDMenu("my_menu");
    myMenu.init();
    }
    function preloadImgs(){
    for(var i=0;i<imgs.length;i++){
    MM_preloadImages(imgs[i]);
    }
    }

    function randomImages(){
    if(counter == (imgs.length)){
    counter = 0;
    }
    // ]]>
    </script>

    Would this work to combine the functions and eliminate the need for the <body onload> command???

    Thanks!
    ~Leanne

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles