HTML and CSS Reference
In-Depth Information
For example, the following XHTML fragment defines a single mouse-
sensitive region in the lower-right quarter of a 100 x 100-pixel image
and another circular region smack in the middle:
<map name="map1">
<area shape="rect" coords="75,75,99,99" nohref="nohref" />
<area shape="circ" coords="50,50,25" nohref="nohref" />
If the coordinates in one <area> tag overlap with another region, the first
<area> tag takes precedence. The browsers ignore coordinates that ex-
tend beyond the boundaries of the image. The href attribute
Like the href attribute for the anchor ( <a> ) tag, the href attribute for the
<area> tag defines the URL of the desired link if its region in the asso-
ciated image map is clicked. The value of the HRef attribute is any valid
URL, relative or absolute, including JavaScript code.
For example, the browser will load and display the link4.html document
if the user clicks in the lower-right quarter of a 100 x 100-pixel image,
as defined by the first image-map <area> tag in the following HTML ex-
<map name="map">
<area coords="75,75,99,99" href="link4.html">
<area coords="0,0,25,25" href="javascript:window.alert('Oooh, tickles!');" >
The second <area> tag in the example uses a javascript URL, which,
when the user clicks in the upper-left quadrant of the image map, ex-
ecutes a JavaScript alert method that displays the silly message in a
dialog box.
Search WWH ::

Custom Search