Hello All,
I am a newbie and trying to understand the variable scopes in JS. I
will try to explain my problem here and see if I make sense.
I created an object test.pgObject=function()
{
.........
this.param=param;
this.runOptions() {
this.buildList();
.......
}
this.buildList(){
this.param;
........
}
}
now i include this object js file in my other pages and initialize
object myobj=new test.pgObject();
then on same page, I have a <Atag which onClick calls
"myobj.runOptions();" . It finds myobj.runoptions fine and object
reference is correct, however when it calls this.buildList , reference
of 'this' changes to window object instead myobj. then i get into
error because it does not find object with 'this' reference.
Is there anyways to do it correctly so that i don't run into problem
like this?
thanks