How to create Web sites easily

The most complete guide for the Web page builder
All you'll
ever need to know about homepages and HTML

Image maps

Click here to return to the index

This page brings info about image maps, be it client-side or server-side. Now you can implement your own image maps!

Server-side image maps

Question posted by Computer Whiz (Gina). Click on the link to go to a cool page. Thanks a lot to you for sending your question!

That big graphic at the beginning of the GeoCities home page (yeah, that one that takes years to load) is an image map. The idea of an image map is that, depending on the region of the graphic that you click, the server directs you to different pages.

When you click an image map on a page, the following happens:

  1. Your browser sends to the host server the coordinates of the exact point of the graphic on which you clicked
  2. The server sends back an URL, in response to your click. That URL depends on the info that the map file had.
Yeah, the map file contains the information that tells your browser where to go, depending on where you clicked.

To create the map file, you'll have to use one of the dozens of image map editors found at Tucows, some are good and fast, some are real bulky. Somehow, I can't help you with the creation of it.

What I can do, is tell you how to put an image map in your page. Upload the graphic file for your image map and the map file you created to your home page's directory. Afterwards put on your page a hyperlink to the map file. Between the <A HREF="xxx"> and </A> tags, put an <IMG SRC="xxx"> tag, pointing to the graphic you designed to be the image map, and include inside the <IMG> tag an ISMAP parameter.

This is an example of an image map, composed by the graphic "geo_b.gif" and the map file "geo_b.map":

<A HREF="geo_b.map"><IMG SRC="geo_b.gif" ISMAP></a>
Note the ISMAP word in the <IMG SRC> tag.

For more information about how to specify file names in tags, click here.

Client-side image maps

This info is going to be very useful to you since this kind of image map is becoming very popular. Thanks to The Omega for this complete info!

Client side imagemaps are (in my opinion) more useful than server-side, since you have more control. To start, you need an image to use as the map. A graphics program that displays a pixel location is also very useful.

How to begin defining a map

Begin with the <MAP> tag, like this:

<MAP NAME="mapname">

That map name will be used to bind a graphic to it. Next, you need to define each active area. Areas are a zone of the graphic that will send you to a location when you click on them. Put an AREA tag for each of the particular areas you want to be clickable:

Parameters for the AREA tag

<AREA SHAPE=value HREF="url" COORDS=number_string ALT="text">

The SHAPE parameter defines an area of an specific form. Here are the choices for a shape in the AREA tag:

The HREF parameter specifies where to go if the specific area is clicked. Put HREF= and an URL between quotes or, if you want no action, put only the word NOHREF instead. For more info on specifying URLs, look here.

As we already defined an area type (shape) we have to set coordinates for it. Use the COORDS parameter as follows:

The ALT parameter has the text you want graphic-disabled browsers to display instead. Just the URLs will be displayed if omitted.

Ending the image map

End the image map with <MAP>.

Binding a graphic with that image map

To place the map on your page, use this tag:

<IMG SRC="map.gif" HEIGHT=### WIDTH=### ALT="Load the @#$%& Map!" USEMAP="#mapname">

It's just a regular image tag, with one new parameter. USEMAP="#mapname" tells it to use mapname as the map, which we defined before.

Notes

Internet Link Exchange
Member of the ILE Free Home Pages at GeoCities


[Main page] [HTML help] [MIDI page] [Murphy's Laws] [More information]
[Feedback form to email me] [Sign guestbook] [Mail me!]