views:

90

answers:

2

What is the execution order of inline events, attachEvent handlers, and an <a> tag's href navigation?

+1  A: 

The execution order of individual event handlers is undefined.

If none of the event handlers called e.preventDefault(), and if onclick didn't return false, a navigation will occur.

SLaks
I always thought tags event had priority over binded ones.
Ben
@Ben: You might be right; I'm not sure. (Check the spec)
SLaks
If using `attachEvent`, this implies IE, which means the event will have no `preventDefault` method. The equivalent is `e.returnValue = false;`.
Tim Down
+1  A: 

Try it yourself: http://jsfiddle.net/rhJ2f/

Ben
even the tag event return false, the binded handler still exec! thanks.
lovespring