|
To access the contents, click the chapter and section titles.
Platinum Edition Using HTML 4, XML, and Java 1.2
Attributes: The <A> tag can take a host of attributes, including
Examples: The following code sets up a simple hyperlink: You can learn more about our <A HREF=prodserv.html TARGET=main ACCESSKEY=P> products and services</A> as well. To follow the link, a user can click the hypertext products and services or press Alt+P (on a Windows machine) or Cmd+P (on a Macintosh). This code establishes a named anchor within a document: ... <A NAME=toc> <H1>Table of Contents</H1> </A> ... With the anchor set up, you can point a hyperlink to it by using code such as this: <A HREF=index.html#toc>Back to the Table of Contents</A> Image and Imagemap TagsWithout images, the Web would just be another version of Gopher. Web graphics give pages powerful visual appeal and often add significantly to the messages that authors are trying to convey. Placing an image on a page is as simple as using the HTML <IMG> tag. In its most basic form, the <IMG> tag needs only one attribute to do its job. However, <IMG> supports as many as 10 attributes that you can use to modify how the image is presented. See Advanced Graphics, p. 155. <IMG> Type: Standalone Function: Places an inline image into a document (see Figure 3.15).
Syntax: <IMG SRC=URL_of_image_file WIDTH=width_in_pixels HEIGHT=height_in_pixels ALT=text_description BORDER=thickness_in_pixels ALIGN=TOP|MIDDLE|BOTTOM|LEFT|RIGHT HSPACE=horizontal_spacing_in_pixels VSAPCE=vertical_spacing_in_pixels LONGDESC=URL_of_long_description ISMAP USEMAP=map_name> Attributes: As you can see from the tags syntax, <IMG> can take several attributes (each attribute is described in detail in this section):
Example: <IMG SRC=/images/logo.gif WIDTH=600 HEIGHT=120 ALT=Welcome to XYZ Corporation USEMAP=#main VSPACE=10> One popular use of images is to set up imagemapsclickable images that take users to different URLs, depending on where they click. Imagemaps are popular page elements on many sites because they provide users with an easy-to-use graphical interface for navigating the site (see Figure 3.16). Imagemaps come in two flavors: server-side and client-side. When a user clicks a server-side imagemap, the coordinates of the click are sent to the server, where a program processes them to determine which URL the browser should load. To accomplish this, the server needs to have access to a file containing information about which regions on the image are clickable and with which URLs those regions should be paired. With client-side imagemaps, the client (browser) processes the coordinates of the users click, rather than passing them to the server for processing. This is a more efficient approach because it reduces the computational load on the server and eliminates the opening and closing of additional HTTP connections. For the browser to be able to process a users click, it has to have access to the same information about the clickable regions and their associated URLs as the server does when processing a server-side imagemap. The method of choice for getting this information to the client is to pass it in an HTML fileusually the file that contains the document with the imagemap, although it does not necessarily have to be this way. HTML 4.0 supports two tags that enable you to store imagemap data in your HTML files: <MAP> and <AREA>. A discussion of these tags rounds out the coverage in this section. See Imagemaps, p. 137.
|
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. |