A multi-event onload function...please help...

Discussion in 'JavaScript' started by pkunzipula, Mar 21, 2008.

  1. #1
    I'm trying to create a multiple-function onload event.

    I have a 6-function .js file.
    The first 4 functions exist just to switch images.
    The 5th is for a dynamic zebra-table effect.
    The 6th is the addLoadEvent for the first 5. Looks like this...

    addLoadEvent(MM_swapImgRestore);
    addLoadEvent(MM_preloadImages);
    addLoadEvent(MM_findObj);
    addLoadEvent(MM_swapImage);
    addLoadEvent(striper);

    The thing is...

    MM_findObj and striper have additional arguments that go...

    function MM_findObj(n,d)

    and

    function striper(parentElement,parentClass,childElement,childClass)

    Where, when and how do I define these arguments? Please explain thoroughly, as I am new at this.

    I thank you for your help, anyone.

    Arlen
     
    pkunzipula, Mar 21, 2008 IP
  2. Logic Ali

    Logic Ali Well-Known Member

    Messages:
    170
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    108
    #2
    addLoadEvent( function(){ striper( param1,param2[,other params]); } );
    Code (markup):
     
    Logic Ali, Mar 21, 2008 IP
  3. lephron

    lephron Active Member

    Messages:
    204
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #3
    or you could simplify it by creating a function that calls all these. Eg:

    
    function myLoad()
    {
         function1(arg1, arg2, arg3);
         function(arg4);
         function(arg2, arg3);
    }
    
    addLoadEvent(myLoad);
    
    Code (markup):
     
    lephron, Mar 22, 2008 IP