Re: howto install event handler
- From: "Richard Cornford" <Richard@xxxxxxxxxxxxxxxxxxx>
- Date: 31 Aug 2006 07:22:20 -0700
nstasiv@xxxxxxxxx wrote:
<snip>
this.obj.onmousedown = function(evt){
this.pickup(evt);
}
won't work as expected, please help!
In javascript the value of - this - is determined entirely by how a
function is called and has no relationship with how or where code that
uses it is declared/defined. When the browser calls an event handler
assigned to an event handling property of an Element it calls that
handler as a method of the Element, and so - this - is a reference to
the Element.
There are several techniques for associating DOM Element's event
handlers with javascript object instances. Many are based upon
closures:-
<URL: http://jibbering.com/faq/faq_notes/closures.html >
Richard.
.
- Follow-Ups:
- Re: howto install event handler
- From: nstasiv
- Re: howto install event handler
- References:
- howto install event handler
- From: nstasiv
- howto install event handler
- Prev by Date: Iframe - Text file data
- Next by Date: Re: howto install event handler
- Previous by thread: howto install event handler
- Next by thread: Re: howto install event handler
- Index(es):
Relevant Pages
|