I have created an object similar to this:
function bar(event)
{
drag(event, this.wid);
}
function foo(wid)
{
this.wid = wid;
this.div = document.create Element("div");
this.div.setAtt ribute("id", wid);
this.caption = document.create Element("div");
this.caption.se tAttribute("id" , "caption");
this.caption.on mousedown = bar;
...
}
Upon running this code this.wid in method bar returns undefined, My
guess is that method bar is running in a different scope, is there
anyway I can customize this method with an additional argument which
would be a variable, or wrap it in another function within object foo's
scope somehow?
Any help is greatly appreciated.
Adonis
function bar(event)
{
drag(event, this.wid);
}
function foo(wid)
{
this.wid = wid;
this.div = document.create Element("div");
this.div.setAtt ribute("id", wid);
this.caption = document.create Element("div");
this.caption.se tAttribute("id" , "caption");
this.caption.on mousedown = bar;
...
}
Upon running this code this.wid in method bar returns undefined, My
guess is that method bar is running in a different scope, is there
anyway I can customize this method with an additional argument which
would be a variable, or wrap it in another function within object foo's
scope somehow?
Any help is greatly appreciated.
Adonis
Comment