Event hierarchy?

  • Thread starter Robert Mark Bram
  • Start date
R

Robert Mark Bram

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
:)
 
L

Laurent Bugnion, GalaSoft

Hi,
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
:)

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
 

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

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top