wolverine wrote:
> I am trying to find the events that occur from a javascript. But
> in a page, onclick event is attached to both an <img> and <body> tags.
> So if the user click on <img> the event first comes to "img" element
> and then to "body" element .
Not quite. The event first propagates down the document tree from the root
of the tree for it to be handled by any element that has a capturing event
listener attached for it. Then it bubbles back up from the deepest child
element to the root of the tree. On that upwards way it is handled by any
element that has a non-capturing event listener attached for it, provided
that it is not canceled before; in this case the `img' and the `body' element.
> Is there any way in IE to find out the event when event reaches <body>
> that it has already been handled by <img> ?
Yes, the respective event target property will tell. It's `srcElement' in
the MSHTML DOM (incl. IE), and `target' in standards (W3C) compliant DOMs.
See <. com> for more.
HTH
PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f806at$ail$1$>
|