John Liu .NET

View Original

HTML map and area tags not working for FireFox

Here was an interesting problem, what was wrong with the following code, which works fine in IE but not in FireFox

<map id="mymap">
<area ... />
<area ... />
</map>

<img usemap="#mymap" ...>


It appears that FireFox doesn't understand the id attribute and the name attribute is required.  According to W3C recommendations, http://www.w3.org/TR/REC-html40/struct/objects.html#adef-usemap the usemap attribute should match the name attribute of the map tag.

Try this instead:

<map id="mymap" name="mymap">