P
Philip
Hi all,
Been having a really tricky problem. I'm trying to do some object oriented
programming with javascript and it was all working fine until I had to
support Netscape 4. The problem is that my object doesn't seem to be able
to refer back to itself. Up until now, I've been using code like this...
function Object
{
var Self = this;
this.Property = Property;
this.Method = Method;
function Method ()
{
alert (Self.Property);
}
}
This is because when the Method was called by an event handler, you couldn't
use 'this' to refer to the object because it was referring to (I believe)
either the event itself or the window or something. Using Self always
worked on Netscape 6, Mozilla, Opera, IE, etc.. but with Netscape 4 it comes
back saying that Self has no properties, leading me to believe that perhaps
it went out of scope? Is this the case? If so, how could I remedy that? I
need to have some kind of variable or property as part of the object that
can refer back to the object itself.
Thanks!
Philip
Been having a really tricky problem. I'm trying to do some object oriented
programming with javascript and it was all working fine until I had to
support Netscape 4. The problem is that my object doesn't seem to be able
to refer back to itself. Up until now, I've been using code like this...
function Object
{
var Self = this;
this.Property = Property;
this.Method = Method;
function Method ()
{
alert (Self.Property);
}
}
This is because when the Method was called by an event handler, you couldn't
use 'this' to refer to the object because it was referring to (I believe)
either the event itself or the window or something. Using Self always
worked on Netscape 6, Mozilla, Opera, IE, etc.. but with Netscape 4 it comes
back saying that Self has no properties, leading me to believe that perhaps
it went out of scope? Is this the case? If so, how could I remedy that? I
need to have some kind of variable or property as part of the object that
can refer back to the object itself.
Thanks!
Philip