Event hierarchy?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Robert Mark Bram

    Event hierarchy?

    Howdy All!

    If I write an image tag inside an anchor tag like this (for a rollover):
    <A HREF="#" onMouseOver=".. ." onMouseOut="... ">
    <IMG SRC="...">
    </A>

    Does the mouse event generated on the IMG tag get sent to the HREF tag's
    handlers because the IMG tag has no handlers?

    What happens if both tags have handlers?

    Rob
    :)


  • Laurent Bugnion, GalaSoft

    #2
    Re: Event hierarchy?

    Hi,

    Robert Mark Bram wrote:[color=blue]
    > Howdy All!
    >
    > If I write an image tag inside an anchor tag like this (for a rollover):
    > <A HREF="#" onMouseOver=".. ." onMouseOut="... ">
    > <IMG SRC="...">
    > </A>
    >
    > Does the mouse event generated on the IMG tag get sent to the HREF tag's
    > handlers because the IMG tag has no handlers?
    >
    > What happens if both tags have handlers?
    >
    > Rob
    > :)[/color]

    IMG tag doesn't have any ONMOUSEOVER or ONMOUSEOUT event handler, which
    is why you need to wrap the image in a A tag.

    The event will be passed to the Link object, NOT to the Image object.
    Simple proof of that is that any reference to "this" in the event
    handler refers to the Link and not to the Image.

    HTH,

    Laurent
    --
    Laurent Bugnion, GalaSoft
    Webdesign, Java, JavaScript: http://www.galasoft-LB.ch
    Private/Malaysia: http://mypage.bluewin.ch/lbugnion
    Support children in Calcutta: http://www.calcutta-espoir.ch

    Comment

    Working...