HTML The Definitive Guide (78 page)

Read HTML The Definitive Guide Online

Authors: Chuck Musciano Bill Kennedy

BOOK: HTML The Definitive Guide
7.42Mb size Format: txt, pdf, ePub

The visual nature of mouse-sensitive images coupled with the need for an effective interface means that you should strongly consider having an artist, a user-interface designer, and even a human-factors expert evaluate your mouse-sensitive imagery. At the very least, engage in a bit of user testing to make sure people know where to click to move to the desired document. Make sure the "mouseable" areas of the image indicate this to the user using a consistent visual mechanism. Consider using borders, drop shadows, or color changes to indicate those areas that can be selected by the user.

Finally, always remember that the decision to use mouse-sensitive images is an explicit decision to exclude text-based and image-restricted browsers from your pages. This includes the many millions of browsers connecting to the Internet via slow modem connections. For these people, downloading your beautiful images is simply too expensive. To keep from disenfranchising a growing population, make sure any page that has a mouse-sensitive image has a text-only equivalent easily accessible from a link on the image-enabled version.

Some thoughtful webmasters even provide separate pages for users preferring full graphics versus mostly text.

7.4 Creating Effective Links

7.6 Creating Searchable

Documents

Chapter 7

Links and Webs

 

7.6 Creating Searchable Documents

Another extensible form of an HTML link that does not use the tag is one that causes the server to search a database for a document that contains a user-specified keyword or words. An HTML

document that contains such a link is known as a
searchable
document.

7.6.1 The Tag (Deprecated)
No longer supported in the HTML 4.0 standard, authors at one time used the tag to pass keywords along with a search-engine's URL to the server. The server then matched the keywords against a database of terms to select the next document for display. Today's authors mostly use forms to pass information to the server and supporting programs. See
Chapter 10
for details.


Function:

Indicates that a document can be searched Attributes:

ACTION

LANG

CLASS PROMPT

DIR STYLE

ID TITLE

End tag:

None

Contains:

Nothing

Used in:

head_content

When a browser encounters the tag, it adds a standard search interface to the document (rendered by Netscape in
Figure 7.8
):



Kumquat Advice Database



Kumquat Advice Database


Search this database to learn more about kumquats!



Figure 7.8: A searchable document

The user types a list of space-separated keywords into the field provided. When the user presses the Enter key, the browser automatically appends the query list to the end of a URL and passes the information along to the server for further processing.

While the HTML standard only allows the tag to be placed in the document header, most browsers let the tag appear anywhere in the document and inserts the search field in the content flow where the tag appears. This convenient extension lets you add instructions and other useful elements before presenting the user with the actual search field.

7.6.1.1 The prompt attribute

The browser provides a leading prompt just above or to the left of the user-entry field. Netscape's default prompt, for example, is, "This is a searchable index. Enter search keywords:" (
Figure 7.8).

That default prompt is not the best for all occasions, so it is possible to change it with the prompt attribute.

When added to the tag, the value of the prompt attribute is the string of text that precedes the keyword entry field placed in the document by the browser.

For example, compare
Figure 7.8 with Figure 7.9
, in which we added the following prompt to the previous source example:

Figure 7.9: The prompt attribute creates custom prompts in searchable documents
Older browsers will ignore the prompt attribute, but there is little reason not to include a better prompt string for your more up-to-date readership.

7.6.1.2 The query URL

Besides the tag in the header of a searchable document, the other important element of this special HTML tag is the query URL. By default, it is the URL of the source document itself - not good if your document can't handle the query. Rather, most authors use the attribute to point to a different URL for the search.
[, 7.7]

The browser appends a question mark to the query URL, followed by the specified search parameters.

Nonprintable characters are appropriately encoded; multiple parameters are separated by a plus sign (+).

In the previous example, if a user types "insect control" in the search field, the browser would retrieve the URL: cgi-bin/quat-query?insect+control

7.6.1.3 The action attribute

For Internet Explorer only, you can specify the query URL for the index with the action attribute.

The effect is exactly as if you had used the href attribute with the tag: the browser links to the specified URL with the search parameters appended to the URL.

While the action attribute provides the desirable feature of divorcing the document's base URL

from the search index URL, it will cause your searches to fail if the user is not using Internet Explorer. For this reason, we do not recommend that you use the action attribute to specify the query URL for the search.

7.6.1.4 The class, dir, id, lang, style, and title attributes
The class and style attributes allow you to supply display properties and class names to control the appearance of the tag, although their value seems limited for . The id and title attributes allow you to create a name and title for the tag; the name might referenced by a hyperlink.

[The id attribute, 4.1.1.4]
[The title attribute, 4.1.1.5]
[Inline Styles: The style Attribute, 9.1.1]
[Style

Classes, 9.2.4]

The dir and lang attributes define the language used for this tag and the direction in which text is rendered. Again, their use is not apparent with
. [The dir attribute, 3.5.1.1] [The lang

Other books

Beautiful Strangers by Glenna Maynard
Street Safe by W. Lynn Chantale
The White Queen by Philippa Gregory
Yuletide Mischief by Rose, Dahlia
Nickels by Karen Baney
Julia Justiss by The Untamed Heiress
We Go On (THE DELL) by Woods, Stephen
The Lost Bradbury by Ray Bradbury