Sams Teach Yourself HTML 4 in 24 Hours

Sams Teach Yourself HTML 4 in 24 Hours

By Dick Oliver

Mapping Regions Within an Image

To make any type of imagemap, you need to figure out the numerical pixel coordinates of each region within the image that you want to turn into a clickable link. An easy way to do this is to open the image with Paint Shop Pro and watch the coordinates at the bottom of the screen as you use the rectangle selection tool to select a rectangular region of the image (see Figure 14.4). When the mouse button is down, the coordinates at the bottom of the screen show both the top-left and bottom-right corners of the rectangle. When the mouse button isn't down, only the x,y position of the mouse is shown.

14fig04.jpg

Figure 14.4 Paint Shop Pro can easily give the coordinates for imagemap regions without mucking about with special image-mapping utilities.

You could use the whole image in Figure 14.4 as an imagemap, linking to seven Web pages about the various literary genres. To do so, you would first need to decide which region of the image should be linked to each Web page. You can use rectangles, circles, and irregular polygons as regions. Figure 14.5 shows an example of how you might divide the image into these shapes.

14fig05.jpg

Figure 14.5 Microsoft FrontPage 2000 lets you draw clickable hotspot links onto your imagemaps with your mouse.

To create the imagemap, first jot down the pixel coordinates of the top-left and bottom-right corners of each rectangular region shown in Figure 14.5. You also need to locate and record the center point and radius of the circle, as well as the coordinates of each corner of the irregularly shaped regions. (If you want to follow along with this by using an image of your own, just write the coordinates on a piece of paper for now. You'll see exactly how to put them into an HTML file momentarily.)

These coordinates are as follows:

Share ThisShare This

Informit Network