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

Discussion in 'Javascript' started by wolverine, Aug 23, 2007.

  1. wolverine

    wolverine Guest

    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.
     
    wolverine, Aug 23, 2007
    #1
    1. Advertising

  2. Re: how to check whether an event has been already handled in IE?

    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 <> 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$>
     
    Thomas 'PointedEars' Lahn, Aug 23, 2007
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Patrick Olurotimi Ige
    Replies:
    6
    Views:
    540
    =?Utf-8?B?TmljZW1hbg==?=
    Mar 11, 2005
  2. Roz Lee
    Replies:
    0
    Views:
    368
    Roz Lee
    Apr 6, 2005
  3. Chris Gallagher

    Check if value has already been used

    Chris Gallagher, Dec 19, 2007, in forum: Ruby
    Replies:
    3
    Views:
    156
    Chris Gallagher
    Dec 19, 2007
  4. JL Smith

    Check whether a form has been modified

    JL Smith, Jul 30, 2003, in forum: Javascript
    Replies:
    0
    Views:
    123
    JL Smith
    Jul 30, 2003
  5. wolverine
    Replies:
    0
    Views:
    124
    wolverine
    Aug 23, 2007
Loading...

Share This Page