L
-Lost
I am calling setTimeout within the context of an object, and whilst this exists, it
refuses to be passed along to the function I call. For example:
$elemById('id').change = function()
{
// the function returns the object itself, 'this' exists
alert(this); // [object HTMLSelectElement]
setTimeout('alert(this);',1000); // [object Window]
}
So, obviously there is something going on that I have not yet learned to deal with.
First, I went with assigning the object (this) to a variable. When I call it, I get
"variable is not defined" making me think that more than just dereferencing (the
reference's scope changing) is going on.
So, what am I missing?
-Lost
refuses to be passed along to the function I call. For example:
$elemById('id').change = function()
{
// the function returns the object itself, 'this' exists
alert(this); // [object HTMLSelectElement]
setTimeout('alert(this);',1000); // [object Window]
}
So, obviously there is something going on that I have not yet learned to deal with.
First, I went with assigning the object (this) to a variable. When I call it, I get
"variable is not defined" making me think that more than just dereferencing (the
reference's scope changing) is going on.
So, what am I missing?
-Lost