What is an Image map
Setting Up the Rollover
What to do
Linking
An image map is a way of defining a hot spot within an image on a Web page. This means that, rather than having the whole image behave as one link like in the first rollover assignment, you can have lots of different links within the one image.
<img src="images/shapes.jpg" width="375" height="102" style="border: none;" alt="Shapes" usemap="#shapes" />
<map name="shapes" id="shapes">
<area shape="circle"
coords="58,50,40"
onmouseover="javascript:clicked_on('circle');"
title="Circle" alt="Circle"/>
<area shape="rect"
coords="136,11,227,89"
onmouseover="javascript:clicked_on('rectangle');"
title="Rectangle" alt="Rectangle"/>
<area shape="poly"
coords="309,13,358,89,257,89"
onmouseover="javascript:clicked_on('triangle');"
title="Triangle" alt="Triangle"/>
<area shape="default"
nohref="nohref" title="Default" alt="Default"/>
</map>
<map name="map-name">
<area shape="area shape"
coords="area coordinates"
href="area hyperlink" or nohref="nohref"
target="hyperlink target"
title="area title"
alt="alternate text"/>
<area shape="area shape" ...
</map>
shape="rect | circle | poly | default"
coords="area-coordinates"
| Shape | Coordinates |
|---|---|
rect |
coords="x1,y1,x2,y2"(The top left and bottom right corners of the rectangle) |
circle |
coords="x,y,r"(The centre and radius of the circle) |
poly |
coords="x1,y1,x2,y2,x3,y3,..."(The corners of the polygon) |
<img src="images/shapes.jpg" width="375" height="102" style="border: none;" alt="Shapes" usemap="shapes.map#shapes"/>
<a href="#"><img src="images/shapes.jpg" width="375" height="102" style="border: none;" alt="Shapes" ismap="ismap"/></a>
.
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>Your Title</title> <meta name="generator" content="BBEdit 7.0.4" /> </head> <body> </body> </html> |
<div> </div>
<a href="#"> <img src="images/buttons.png" style="border: none;" alt="buttons" ismap="ismap"/> </a>
| Shape | Coordinates |
|---|---|
rect |
coords="x1,y1,x2,y2"(The top left and bottom right corners of the rectangle) |
circle |
coords="x,y,r"(The centre and radius of the circle) |
poly |
coords="x1,y1,x2,y2,x3,y3,..."(The corners of the polygon) |
<map name="buttons" id="buttons"> <area buttons="your_shape" coords="your_coordinates" onmouseover="javascript:show(img1.src);" title="img1" alt="img1"/> <area buttons="your_shape" coords="your_coordinates" onmouseover="javascript:show(img2.src);" title="img2" alt="img2"/> <area buttons="your_shape" coords="your_coordinates" onmouseover="javascript:show(img3.src);" title="img3" alt="img3"/> <area shape="default" href="javascript:show(img0.src);" title="Default" alt="Default"/> </map>
<script type="text/javascript">
//<!--
//-->
</script>var image0 = new Image(); image0.src = "address_of_default_image.jpg"; var image1 = new Image(); image1.src = "address_of_image_1.jpg'"; var image2 = new Image(); image2.src = "address_of_image_2.jpg'"; var image3 = new Image(); image3.src = "address_of_image_3.jpg'";
images/rollover2/_0000_bg0.jpg
images/rollover2/_0001_bg1.jpg
images/rollover2/_0002_bg2.jpg
images/rollover2/_0003_bg3.jpg
function show(img){
document.getElementById('roll').src=img;
}
<tr>
<td class="assignment"><a href="last_assignment.html">last assignment</a></td>
<td class="description">Applications used</td>
<td class="date">9/20/05</td>
</tr>
<tr>
<td class="assignment"><a href="last_assignment.html">last assignment</a></td>
<td class="description">Applications used</td>
<td class="date">9/20/05</td>
</tr>
<tr>
<td class="assignment"><a href="last_assignment.html">last assignment</a></td>
<td class="description">Applications used</td>
<td class="date">9/20/05</td>
</tr>
<td class="assignment">Face Game</td>
<td class="description">BBEdit, Photoshop and Javascript</td>
<td class="date"></td>