469,336 Members | 5,285 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,336 developers. It's quick & easy.

JavaScript DOM Event

I have created an object similar to this:

function bar(event)
{
drag(event, this.wid);
}

function foo(wid)
{
this.wid = wid;
this.div = document.createElement("div");
this.div.setAttribute("id", wid);
this.caption = document.createElement("div");
this.caption.setAttribute("id", "caption");
this.caption.onmousedown = 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
Sep 17 '05 #1
1 1312
Nevermind found a workaround myself.

Adonis
Sep 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

16 posts views Thread by Tony Girgenti | last post: by
19 posts views Thread by maya | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by haryvincent176 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.