Reply
Fri 7 Aug, 2009 01:56 pm
Hi,
I would like to know if this is possible in some way?
var $object1 = {
$id : 1,
test : function()
{
alert(this.$id);
}
};
var $object2 = new function()
{
this.$id = 2;
this.test = function()
{
alert(this.$id);
};
//ASSIGN OBJECT1 WITH THIS INTERNAL FUNCTION
$object1.test = this.test;
};
$object1.test();
$object2.test();
The result I was must be that both $object1 and $object2 alert with the number 2.
Thanks!