View Single Post
Old 11-13-2005, 10:31 AM   #1
jaguar
whig
 
Join Date: Apr 2001
Posts: 5,075
Javascript functions...

Here we go again...

I'm playing around with something at the moment, I'm trying to find a way to be able to call pass a function as a paramater to another function, for example:


Code:
var obj = new Object();

obj.test = function() {
alert("working!");
}

obj.run(param) {
param;  //execute param, in theory.
}
so that when you call:
obj.run(obj.test);
obj.test gets executed. Obviously it doesn't work. A bit of playing around had led me to believe it is simply putting the code of the function there instead of running it, whether it's a named function of an anonymous function attached to an object. Anyone got any ideas?
__________________
Good friends, good books and a sleepy conscience: this is the ideal life.
- Twain
jaguar is offline   Reply With Quote