By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,382 Members | 1,645 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,382 IT Pros & Developers. It's quick & easy.

Event hierarchy?

P: n/a
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
:)
Jul 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi,

Robert Mark Bram wrote:
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
--
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

Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.