Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: Apply method

  1. #1
    Senior Coder
    Join Date
    Dec 2005
    Location
    Slovenia
    Posts
    1,958
    Thanks
    120
    Thanked 76 Times in 76 Posts

    Apply method

    Code:
        function executeObjMethod(obj,method,parameters)
        {
      
          try
          {
            if (parameters != null) 
            {
              window[obj][method].apply(window[obj][method], parameters); 
            }
            else
            {
              window[obj][method]();
            }
          }
          catch(err)
          { 
            alert('err:' + err);
          }
        }  
          
          
    
        function AjaxSubMenu() 
        { 
          this.subMenusData = new Array();
          this.subMenusData.push("˛blj"); 
          this.changeSubMenus = function(arrayIndex) 
          { 
            alert(this.subMenusData[arrayIndex]); 
          } 
        }; 
        
        ajaxSubMenu = new AjaxSubMenu();
        
        // this works
        ajaxSubMenu.changeSubMenus('0');
        
        // this does not , why ?
        executeObjMethod('ajaxSubMenu','changeSubMenus',new Array('0'));

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    And your question is...?
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*


  •  

    Posting Permissions

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