how to check whether an event has been already handled in IE ?

W

wolverine

Hi,
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 . Is there any way in IE to find out the
event when event reaches <body> that it has already been handled by
<img> ?

Thanks in Advance
Kiran.
 
T

Thomas 'PointedEars' Lahn

wolverine said:
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 <[email protected]> for more.


HTH

PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top