Index
July 24 2006
The image below uses an image map, and has a mousedown event registered.
In Internet Explorer 6, the mousedown event fires.
In Opera 9 (Windows/Mac), Firefox 1.5 (Windows/Mac) and Safari 2, the event
fires of you click on the white area in the image, but not if you click on
the red area (which has an <area> overlay in the image map).
Workaround:
Add event listeners to all <area> tags in the image map (note in
Internet Explorer the event handler will then fire twice).
Discussion:
It appears that the bug is with IE6. In the html, the area tag is
not a child of the img tag, and as such it should not inherit the
event handlers:
<img src="testimg.gif" id="testimg" usemap="#testimgmap" title="image" onmousedown="msdown(event);" /> <map name="testimgmap" id="testimgmap"> <area shape="rect" coords="50,50,100,100" title="red area" /> </map>
Another example: two divs that are siblings:
<div id="outerdiv" onmousedown="msdown(event);"> </div> <div id="innerdiv"> </div>
Use absolute positioning to position the inner div over the outer div (example). The event fires when clicking in the outer div, but not when clicking in the inner div. This works correctly across all browsers.