A Complete Guide to Web Design

(やまだぃちぅ) #1
Imagemaps 137

Creating Links

Imagemaps

Web Design in a Nutshell, eMatter Edition

Targeting Windows


The problem with the hypertext medium is that when a user clicks on an inter-
esting link on your page, he might never come back! One currently popular
solution to this problem is to make the target document display in a second
browser window. In that way, your page is still readily available.


Use thetargetattribute of the anchor tag to launch a new browser window for
the linked document. Setting thetarget="_blank"attribute causes the browser
to open a fresh browser window. For example:


<A HREF="http://www.webreview.com/" TARGET="_blank">...</A>

If you set every link on your page to target a_blankwindow, every link will
launch a new window, potentially leaving your user with a mess of open
windows.


A better method, especially if you have more than one link, is to give the targeted
window a specific name, which can then be reused by subsequent links. The
following link will open a new window called “display”:


<A HREF="http://www.webreview.com/" TARGET="display">...</A>

If you target every link on that page to the “display” window, each targeted docu-
ment will open in the same second window.


Thetargetattribute is most often used in conjunction with framed documents.
The syntax and strategy for using the target attribute with framed documents is
discussed in Chapter 11.


Some browsers do not support the target attribute (including
WebTV and MSIE2.0 and earlier). Furthermore, Netscape Navigator
4.0 has a bug that prevents the new named window from coming to
the front. To the user, this looks as though the link did not work
since the target document loads into a browser window that is stuck
behind the current window.

Imagemaps


Ordinarily, placing a graphic within anchor tags will make the entire image a link
to a single document, regardless of where the user clicks on the image. It is also
possible (and quite common) to create multiple links, or “hot spots,” within a
single graphic. These graphics are calledimagemaps. The effect is created with
HTML tags and/or text files and scripts on the server; the graphic itself is an ordi-
nary graphic that just serves as a backdrop for the pixel coordinates.


There are two types of imagemaps: client-sideand server-side. For client-side
imagemaps, the coordinate and URL information necessary to create each link is
contained right in the HTML document. The process of putting the pieces together
happens in the browser on the user’s machine (thus, client-side). For server-side

Free download pdf