|
To access the contents, click the chapter and section titles.
HTML 4.0 Sourcebook
Table 3.1 gives the specifications of the five methods for declaring active regions in an imagemap database.
Referencing the Imagemap Database Now that you have a databasefor example the blobby.map database of Figure 3.3where should you put it, and how does the imagemap program know where to find it? This database can go anywhere you can put regular HTML documents or data files. You indicate its location to the imagemap program via extra path information in the URL. For example, let us suppose that the Web server document directory is /u/Web and that the collection of documents and images related to Mr. Blobby is found in the directory /u/Web/weird/blobby. One choice is to put the map file in the same directory as the image, so that the absolute path for the map file is /u/Web/weird/blobby/blobby.map. You access this map file from imagemap by using the markup <A HREF=<http://some.site.edu/cgi-bin/imagemap/weird/blobby/blobby.map>> <IMG SRC=blobby.gif ISMAP> </A> where some.site.edu is the site containing the documents and the extra path information that references the imagemap database is in boldface. Note that the path to blobby.map, relative to the document directory of the HTTP server (/u/Web), has been added to the imagemap URL (it is shown in boldface). The string /weird/blobby/blobby.map is passed to imagemap and is used by the program to locate the database blobby.map. With most servers, this method is not restricted to the regular document directory. If a user has a personal HTML directory, he or she can place map files in this directory and access the maps using URLs like <A HREF=<http://some.site.edu/cgi-bin/imagemap/~user/path/blobby.map>> <IMG SRC=blobby.gif ISMAP> </A> where user is the username of the person with the personal public HTML directory and path/blobby.map is the path leading to the map file from the root of his or her personal document directory. Getting a Click to Do Nothing Sometimes, you want a click to do nothing. For example, your image could be a map of buildings, and you dont want anything to happen if the user clicks on nonmapped objects, like roads or trees. In this case, you might want the browser to keep the current document on the browser window screen. This can be accomplished by linking the default method in your imagemap file to a server CGI program that returns a response message to the client. In Figure 3.3, the default method references the UNIX shell script nph-no_op.sh, designed to do exactly this. This script, along with an equivalent program written in perl, is listed in Figure 3.5. Figure 3.5 Listing for (A) the Bourne shell script nph-no_op.sh, and (B) the perl script nph-no_op.pl. Both return HTTP headers that tell a browser to continue displaying the currently displayed document. (A) nph-no_op.shBourne shell script #!/bin/sh echo HTTP/1.0 204 No response -- server CGI-script output echo Content-type: text/plain echo Server: $SERVER_SOFTWARE echo (B) nph-no_op.plPerl script #!/bin/perl print HTTP/1.0 204 No Response -- CGI script output \r\n; print Content-type: text/plain\r\n; print Server: $ENV{SERVER_SOFTWARE}\r\n; print \r\n; #Blank line ending the header Output from scripts having an nph- prefix is sent directly to the client without being parsed by the server (see Chapter 10 for more information on non-parsed header gateway programs). This script sends the HTTP status code 204, which tells the client that there is no server message and that the client should continue displaying the current document.
|
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. |