ppcguy wrote:
i've got this for IE:
node.onchange = foo;
but really i'd like to pass node object to foo function also.
in html i would do onchange="foo(this)"...but this has to
be done in javascript at runtime.
You don't need to as - this - inside - foo - will already refer to your
- node - object when it is called as the onclick handler for - node -.
This works because when in HTML you do:-
<X onclick="foo(this);">
- the browser used the string value of the onclick attribute as the
body for a function it creates internally and assigns to the - onclick
- property of the element. So the above is equivalent to:-
node.onclick = function(){
foo(this);
};
(where - node - refers to the element that would have the onclick
attribute otherwise). And then when the browser responds to a click
event it calls this function assigned to the - onclick - property of
the element as a method of the element so - this - refers to the
element.
Richard.