ptg16476052
What Is an Imagemap? 231
9
are noted using the coords attribute. For example, the coords attribute for a poly shape
appears as follows:
Each x,y combination represents a point on the polygon. For rect shapes, x1,y1 is the
upper-left corner of the rectangle, and x2,y2 is the lower-right corner:
For circle shapes, x,y represents the center of a circular region of size radius:
The default shape is different from the others—it doesn’t require coordinates to be spec-
ified. Instead, the link associated with the default shape is followed if the user clicks
anywhere on the image that doesn’t fall within another defined region.
Another attribute you need to define for each tag is the href attribute. You can
assign href any URL you usually would associate with an link, including relative
pathnames. In addition, you can assign href a value of "nohref" to define regions of the
image that don’t contain links to a new page.
If you’re using client-side imagemaps with frames, you can
include the target attribute inside an <area> tag to open a
new page in a specific window, as in this example:
<area shape="rect" coords="x1,y1,x2,y2" href="URL" target=
"window_name">
NOTE
You need to include one more attribute in HTML5. Earlier in this lesson, you learned
how to specify alternate text for images. In HTML5, the alt attribute is an additional
requirement for the tag that displays a short description of a clickable area on a
client-side imagemap when you pass your cursor over it. Using the example that I
cited, the alt attribute appears as shown in the following example:
The usemap Attribute
After you’ve created your