Forum Moderators: open
I have stepped into a bit of a problem. I need a determined javascript function to call another user-defined js function depending on a different number of reasons.
The problem: the function name is passed as a parameter in the form of a string. It is stored in an object (kind of a class type of, with multiple members and nodes as well) for later use (and is also appended to an HTML tag event handler dinamically after the page is loaded).
The question: since there is no (real) pointer capabilities in javascript, how can I call the function, whose name is stored as a string?
Please note the function name must reside as a string in the object mentioned above (cannot use the object pointer).
As always, all help is welcome. Thank you. :)
d#Nimrod
function callPerson(arg) {
alert(arg);
}
var myString1 = "callPerson";
var myString2 = "Bob";
eval( myString1 + "(" + myString2 + ")" );