|
To access the contents, click the chapter and section titles.
Platinum Edition Using HTML 4, XML, and Java 1.2
Example: A Navigation ImagemapAnother common use of imagemaps is for navigation bars at the top or bottom of a Web page. Figure 4.2 shows a typical navigation graphic with the hot regions defined by the information in Table 4.3.
To use the image in Figure 4.2 as a client-side imagemap, you first need to set up the map information in an HTML file: <MAP NAME=navigate> <AREA SHAPE=rect COORDS=1,1,112,36 HREF=<http://www.server.com/index.html> ALT=Home Page> <AREA SHAPE=rect COORDS=113,1,224,36 HREF=<http://www.server.com/new.html> ALT=Whats New> <AREA SHAPE=rect COORDS=225,1,335,36 HREF=<http://www.server.com/info.html> ALT=Information> <AREA SHAPE=rect COORDS=336,1,447,36 HREF=<http://www.server.com/search/index.html> ALT=Search> <AREA SHAPE=rect COORDS=448,1,560,36 HREF=<http://www.server.com/contact.html> ALT=Contact Us> </MAP> With the map data in place, you can reference it with the <IMG> tag if the map data is in the same HTML file: <IMG SRC=images/navigate2.gif USEMAP=#navigate>
Because the same navigation maps are often used on several pages on a site, you might want to put the map data in a single map file and reference the file each time you need the map: <IMG SRC=images/navigate2.gif USEMAP=maps.html#navigate> As noted earlier, this is an efficient way to manage imagemaps common to many pages. Server-Side ImagemapsA server-side imagemap is one in which the server determines which document should be loaded, based on where the user clicked the imagemap. To make this determination, the server needs the following information:
Additionally, you need two other ingredients to complete a server-side imagemap:
As an HTML author, you need to be most concerned about two of the items just listed: the map file and the setup in the HTML file. The next two sections discuss these aspects of creating an imagemap. Preparing the Map FileThe map file is a text file that contains information about the hot regions of a specific imagemap graphic. Therefore, a separate map file is necessary for each imagemap graphic you want to use. The definition specifies the type of hot region as a rectangle, circle, polygon, or point. The following list identifies basic imagemap shape keywords and their required coordinates:
|
Products | Contact Us | About Us | Privacy | Ad Info | Home
Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc. All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement. |