Dudsmack
10-27-2003, 03:19 PM
I want to add a function to an object. I have a contructor:
function fncName(param1, param2)
{
...some code
}
have an object (with existing properties):
tempObject
I want to add this function to the object so that I could use the object and call it anytime, say:
tempObject.fnc(param1, param2);
so when i try to add it to the object:
tempObject.fnc = new fncName(); it errors because i'm leaving the arguments blank. How can I work it so I can append this function to the object without having to pass it arguments?
function fncName(param1, param2)
{
...some code
}
have an object (with existing properties):
tempObject
I want to add this function to the object so that I could use the object and call it anytime, say:
tempObject.fnc(param1, param2);
so when i try to add it to the object:
tempObject.fnc = new fncName(); it errors because i'm leaving the arguments blank. How can I work it so I can append this function to the object without having to pass it arguments?