not true. Or at least half-true.
If you want to pass "this" to the anonymous function, you *must* do so yourself.
Example:
Code:
document.getElementById("bla").onclick = function(e) { myClickHandler(e, this, “John Merlino”); };
Now, having said that, it's really not necessary to pass
this as you can always get the object that caused the event from the event object. But it's often more convenient to do so, as if you use the event object you have to write browser-sensitive code.
**********
By the way, the first code example there is wrong:
Code:
if (myDOMNode.onclick)
myDOMNode.onclick();
It would normally be:
Code:
if (myDOMNode.onclick)
myDOMNode.click();
That is, you simulate the *event* and that invokes the function that is referenced by the event *handler*.