...

View Full Version : Apply method



BubikolRamios
07-16-2007, 12:08 AM
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'));

Kor
07-16-2007, 08:18 AM
And your question is...?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum