map elementname
interface HTMLMapElement : HTMLElement {
attribute DOMString name;
readonly attribute HTMLCollection areas;
readonly attribute HTMLCollection images;
};
The map element, in conjunction with any
area element descendants, defines an
image map. The element represents
its children.
The name attribute gives the map a
name so that it can be referenced. The attribute must be present
and must have a non-empty value with no space characters.
The value of the name attribute must not be a compatibility-caseless match for the
value of the name attribute of another map element in the same document. If the
id attribute is also specified, both
attributes must have the same value.
areasReturns an HTMLCollection
of the area elements in the map.
imagesReturns an HTMLCollection
of the img and object elements that use the
map.
Image maps can be defined in conjunction with other content on the page, to ease maintenance. This example is of a page with an image map at the top of the page and a corresponding set of text links at the bottom.
<!DOCTYPE HTML>
<TITLE>Babies™: Toys</TITLE>
<HEADER>
<H1>Toys</H1>
<IMG SRC="/images/menu.gif"
ALT="Babies™ navigation menu. Select a department to go to its page."
USEMAP="http://www.w3.org/TR/2012/WD-html5-20121025/single-page.html#NAV">
</HEADER>
...
<FOOTER>
<MAP NAME="NAV">
<P>
<A HREF="/clothes/">Clothes</A>
<AREA ALT="Clothes" COORDS="0,0,100,50" HREF="/clothes/"> |
<A HREF="/toys/">Toys</A>
<AREA ALT="Toys" COORDS="0,0,100,50" HREF="/toys/"> |
<A HREF="/food/">Food</A>
<AREA ALT="Food" COORDS="0,0,100,50" HREF="/food/"> |
<A HREF="/books/">Books</A>
<AREA ALT="Books" COORDS="0,0,100,50" HREF="/books/">
</MAP>
</FOOTER>