Dynamic HTML: The Definitive Reference, 2rd Ed.Dynamic HTML: The Definitive ReferenceSearch this book
PreviousNext

8.3. Alphabetical Tag Reference

<a> NN all IE all HTML all

<a>...</a> HTML End Tag: Required
The a element is the rare element that can be an anchor and/or a link, depending on the presence of the name and/or href attributes. As an anchor, the element defines a named location in a document to which any URL can reference by appending a hashmark and the anchor name to the document's URI (for example, http://www.megacorp.com/contents#a-c). Names are identifiers assigned to the name attribute (or in newer browsers, the id attribute). Content defined solely as an anchor is not (by default) visually differentiated from surrounding body content.

By assigning a URI to the href attribute, the element becomes the source of a hypertext link. Activating the link generally navigates to the URI assigned to the href attribute (or it may load other media into a helper application or plugin without changing the page). Unless modified by style sheets, links typically have a distinctive appearance in the browser, such as an underline beneath text (or border around an object) and a color other than the current content color. Attributes can define separate colors for three states: an unvisited link, a link being activated by the user, and a previously visited link (the linked document is currently in the browser cache). Such color control is deprecated in favor of CSS pseudo-classes (:link, :active, :visited, and a new state, :hover). An a element can be both an anchor and a link if, in the least, both the name (or id) and href attributes have values assigned to them.

Example

<a name="anchor3" id="anchor3">Just an anchor named "anchor3."</a>
<a href="#anchor3">A link to navigate to "anchor3" in the same document.</a>
<a name="anchor3" id="anchor3" href="http://www.megacorp.com/index.html">
Go from here (anchor 3) to home page.</a>

Object Model Reference

[window.]document.links[i]
[window.]document.anchors[i]
[window.]document.getElementById(elementID)

Element-Specific Attributes

charset coords datafld datasrc href
hreflang methods name rel rev
shape target type urn  

Element-Specific Event Handler Attributes

None. Anchor-only a elements have no event handlers in Navigator through Version 4.

charsetNN 6 IE n/a HTML 4

charset="characterSet"Optional
Character encoding of the content at the other end of the link.

Example

<a charset="csISO5427Cyrillic" href="moscow.html">Visit Moscow</a>

Value

Case-insensitive alias from the character set registry (ftp://ftp.isi.edu/in-notes/iana/assignments/character-sets).

Default

Determined by browser.

coordsNN n/a IE 6 HTML 4

coords="coord1, ... coordN"Optional
Although defined for the a element, the coords attribute applies to the area element for client-side image maps. The area element "inherits" many attributes and behaviors of the a element. See the area element.

datafldNN n/a IE 4 HTML n/a

datafld="columnName"Optional
Used with IE data binding to associate a remote data source column name in lieu of an href attribute for a link. The data source column must contain a valid URI (relative or absolute). A datasrc attribute must also be set for the element. Works only with text file data sources in IE 5/Mac.

Example

<a datasrc="DBSRC3" datafld="newsURL">Late-Breaking News</a>

Value

Case-sensitive identifier.

Default

None.

Object Model Reference

[window.]document.links[i].dataFld
[window.]document.getElementById(elementID).dataFld 
datasrcNN n/a IE 4 HTML n/a

datasrc="dataSourceName"Optional
Used with IE data binding to specify the ID of the page's object element that loads the data source object for remote data access. Content from the data source to be inserted into the a element text is specified via the datafld attribute. Works only with text file data sources in IE 5/Mac.

Example

<a datasrc="DBSRC3" datafld="newsURL">Late-Breaking News</a>

Value

Case-sensitive identifier.

Default

None.

Object Model Reference

[window.]document.links[i].dataSrc
[window.]document.getElementById(elementID).dataSrc 
hrefNN all IE all HTML all

href="URI"Required for links
The URI of the destination of a link. In browsers, when the URI is an HTML document, the document is loaded into the current (default) or other window target (as defined by the target attribute). For some other file types, the browser may load the destination content into a plugin or save the destination file on the client machine. In the absence of the href attribute, the element does not distinguish itself in a browser as a clickable link and may instead be only an anchor (if the name or id attribute is set).

Example

<a href="part1/chap3.html">Chapter 3</a>

Value

Any valid URI, including complete and relative URLs, anchors on the same page (anchor names prefaced with the # symbol), and the javascript: pseudo-URL in scriptable browsers to trigger a script statement rather than navigate to a destination.

Default

None.

Object Model Reference

[window.]document.links[i].href
[window.]document.getElementById(elementID).href

In both browsers, other link object properties allow for the extraction of components of the URL, such as protocol and hostname. See the a element in Chapter 9.

hreflangNN 6 IE 6 HTML 4

hreflang="languageCode"Optional
The language code of the content at the destination of a link. Requires that the href attribute also be set. This attribute is primarily an advisory attribute to help a browser prepare itself for a new language set if the browser is so enabled.

Example

<a hreflang="HI" href="hindi/Chap3.html>Chapter 3 (in Hindi)</a>

Value

Case-insensitive language code.

Default

Browser default.

methodsNN n/a IE 4 HTML n/a

methods="http-method"Optional
An advisory attribute about the functionality of the destination of a link. A browser could use this information to display special colors or images for the element content based on what the destination will do for the user.

Example

<a href="http://www.megacorp.com/cgi-bin/search?chap3" methods="get">
Chapter 3</a>

Value

Comma-delimited list of one or more HTTP methods.

Default

None.

Object Model Reference

[window.]document.links[i].Methods
[window.]document.getElementById(elementID).Methods 
nameNN all IE all HTML all

name="elementIdentifier"Required for anchors
The traditional way to signify an anchor position within a document. Other link elements can refer to the anchor by setting their href attributes to a URL ending in a pound sign (#) followed by the identifier. Omitting the name (and id) attribute for the a element prevents the element from being used as an anchor position. This attribute is interchangeable with the id attribute in recent browsers. The attribute is deprecated in XHTML 1.0, so you are encouraged to use both attributes (with the same identifier) to keep all browser generations happy. If the name and href attribute are set in the element, the element is considered both an anchor and a link.

Example

<a id="sect3" name="sect3">Section III</a>

Value

Case-sensitive identifier.

Default

None.

Object Model Reference

[window.]document.links[i].name
[window.]document.anchors[i].name
[window.]document.getElementById(elementID).name
relNN 6 IE 3 HTML 4

rel="linkTypes"Optional
Defines the relationship between the current element and the destination of the link. Also known as a forward link, not to be confused in any way with the destination document whose address is defined by the href attribute. The HTML 4 recommendation defines several link types; it is up to the browser to determine how to employ the value. This attribute has meaning primarily for the link element, although there is significant room for future application for tasks such as assigning an a element (acting as a link) to a button in a static navigation bar pointing to the next or previous document in a series. The element must include an href attribute for the rel attribute to be applied.

Example

<a rel="next chapter" href="chapter3.html">Chapter 3</a>

Value

Case-insensitive, space-delimited list of HTML 4 standard link types applicable to the element. Sanctioned link types are:

alternate appendix bookmark chapter
contents copyright glossary help
index next prev section
start stylesheet subsection

In addition, IE 3 defined a fixed set of four values: same | next | parent | previous, but only next and previous continue to be supported in IE.

Default

None.

Object Model Reference

[window.]document.links[i].rel
[window.]document.getElementById(elementID).rel 
revNN 6 IE 3 HTML 4

rev="linkTypes"Optional
A reverse link relationship. Like the rel attribute, the rev attribute's capabilities are defined by the browser, particularly with regard to how the browser interprets and renders the various link types available in the HTML 4 specification. Given two documents (A and B) containing links that point to each other, the rev value of B is designed to express the same relationship between the two documents as denoted by the rel attribute in A. There is not yet much application of either the rel or rev attributes of the a element in mainstream browsers.

Example

<a rev="previous" href="chapter2.html">Chapter 2</a>

Value

Case-insensitive, space-delimited list of standard link types applicable to the element. See the rel attribute for sanctioned and supported link types.

Default

None.

Object Model Reference

[window.]document.links[i].rev
[window.]document.getElementById(elementID).rev 
shapeNN n/a IE n/a HTML 4

shape="shape"Optional
Defines the shape of a server-side image map area whose coordinates are specified with the coords attribute. See the area element.
targetNN all IE all HTML all

target="windowOrFrameName"Optional
If the destination document is to be loaded into a window or frame other than the current window or frame, you can specify where the destination document should load by assigning a window or frame name to the target attribute. Target frame names must be assigned to frames and windows as identifiers. Assign names to frames via the name and id attributes of the frame element; assign names to new windows via the second parameter of the window.open( ) scripting method. If you omit this attribute, the destination document replaces the document containing the link. An identifier other than one belonging to an existing frame or window opens a new window for the destination document. This attribute is applicable only when a value is assigned to the href attribute of the element.

A link element can have only one destination document and one target. If you want a link to change the content of multiple frames, you can use an a element's onclick event handler or a javascript: pseudo-URL to fire a script that loads multiple documents. Set the location.href property of each frame to a desired URL.

Strict DTDs for HTML 4 and XHTML do not support the target attribute of any element because frames and windows are outside the scope of pure document markup. In fact, framesetting documents will not validate in the strict environment—thus the purpose of the separate frameset DTDs for HTML 4 and XHTML. If your documents must validate with these strict DTDs, and you wish to support targets, use scripts to set target properties of links, image maps, and forms after the page has loaded.

Example

<a target="display" href="chap3.html#sec2">Section 3.2</a>
<a target="_top" href="index.html">Start Over</a>

Value

Case-sensitive identifier when the frame or window name has been assigned via the target element's name and id attributes. Four reserved target names act as constants:

_blank
Browser creates a new window for the destination document.

_parent
Destination document replaces the current frame's framesetting document (if one exists; otherwise, it is treated as _self).

_self
Destination document replaces the current document in its window or frame.

_top
Destination document is to occupy the entire browser window, replacing any and all framesets that may be loaded (also treated as _self if there are no framesets defined in the window).

Default

_self

Object Model Reference

[window.]document.links[i].target
[window.]document.getElementById(elementID).target
typeNN 6 IE 6 HTML 4

type="MIMEType"Optional
An advisory about the content type of the destination document or resource. A browser might use this information to assist in preparing support for a resource requiring a multimedia player or plugin.

Example

<a type="video/mpeg" href="ski4.mpeg">View Devil's Ghost slope</a>

Value

Case-insensitive MIME type. A catalog of registered MIME types is available from ftp://ftp.isi.edu/in-notes/iana/assignments/media-types/.

Default

None.

urnNN n/a IE 4 HTML n/a

urn="urn"Optional
A Uniform Resource Name version of the destination document specified in the href attribute. This attribute is intended to offer support in the future for the URN format of URI, an evolving recommendation under discussion at the IETF (see RFC 2141). Although supported in IE 4 and later, this attribute does not take the place of the href attribute.

Example

<a urn="urn:foo:bar3" href="chapter3.html">Chapter 3</a>

Value

A valid URN in the form of "urn:NamespaceID:NamespaceSpecificString".

Default

None.

Object Model Reference

[window.]document.links[i].urn  
[window.]document.getElementById(elementID).urn
<abbr>NN 6 IE n/a HTML 4

<abbr>...</abbr>HTML End Tag: Required
The abbr element provides an encapsulation and enumeration mechanism for abbreviations that appear in the body text. For example, consider a web page that includes your company's address. At one point in the document, the abbreviation IA is used for Iowa. A spelling checker, language translation program, or speech synthesizer might choke on this abbreviation; a search engine would not include the word "Iowa" in its relevancy rating calculation. But by turning the IA text into an abbr element (and assigning a title attribute to it), you can provide a full-text equivalent that a search engine (if so equipped) can count; a text-to-speech program would read aloud the full state name instead of some guttural gibberish. Like many elements introduced in HTML 4.0, this one is intended to assist browser technologies that may not yet be implemented but could find their way into products of the future.

Netscape 6 renders the abbr element with a dotted underline, and turns the cursor into a help icon. The context menu for such an element contains a Properties choice, which leads to a displayed list of attributes and their values for the visitor.

A related element, acronym, offers the same services for words that are acronyms (although Netscape 6 offers no special rendering). Both elements are part of a larger group of what the HTML 4.0 recommendation calls phrase elements.

Example

Ottumwa, <abbr title="Iowa">IA</abbr> 55334<br>
<abbr lang="de" title="und so weiter">usw.</abbr>

Object Model Reference

[window.]document.getElementById(elementID)

Element-Specific Attributes

None.

Element-Specific Event Handler Attributes

None.

<acronym>NN 6 IE 4 HTML 4

<acronym>...</acronym>HTML End Tag: Required
The acronym element provides an encapsulation and enumeration mechanism for acronyms that appear in the body text. For example, consider a web page that includes a discussion of international trade issues. At one point in the document, the acronym GATT is used for General Agreement on Tariffs and Trade. A spelling checker, language translation program, or speech synthesizer might choke on this acronym; a search engine would not include the word "tariffs" in its relevancy rating calculation. But by turning the GATT text into an acronym element (and assigning a title attribute to it), you can provide a full-text equivalent that a search engine (if so equipped) can count; a text-to-speech program would read aloud the full meaning of the acronym. Like many elements introduced in HTML 4.0, this one is intended to assist browser technologies that may not yet be implemented but could find their way into products of the future.

A related element, abbr, offers the same services for words that are abbreviations. Both elements are part of a larger group of what the HTML 4 recommendation calls phrase elements.

Example

<acronym title="General Agreement on Tariffs and Trade">GATT</acronym>
<acronym lang="it" title="Stati Uniti">s.u.</acronym>

Object Model Reference

[window.]document.getElementById(elementID)

Element-Specific Attributes

None.

Element-Specific Event Handler Attributes

None.

<address>NN all IE all HTML all

<address>...</address>HTML End Tag: Required
Prior to HTML 4, the address element was often regarded as a display formatting tag appropriate for displaying a page author's contact information on the page. Navigator and Internet Explorer display address elements in an italic font. But the increased focus on separating content from form in HTML 4 adds some extra meaning to this element. Search engines and future HTML (or XML) parsers may apply special significance to the content of this element, perhaps in cataloging author information separate from the hidden information located in meta elements. If you want to use this structural meaning of the element while keeping the rendering in line with the rest of your body text, you need to assign style sheet rules to override the browser's default formatting tendencies for this element. Any standard body elements, such as links, can be contained inside an address element.

Example

<address>
<p>Send comments to:<a href="mailto:jb@megacorp.com">jb@megacorp.com</a>
</p>
</address>

Object Model Reference

[window.]document.getElementById(elementID)

Element-Specific Attributes

None.

Element-Specific Event Handler Attributes

None.

<applet>NN 2 IE 3 HTML 3.2

<applet>...</applet>HTML End Tag: Required
You can embed an executable chunk of Java code in an HTML document in the form of an applet. An applet occupies a rectangular area of the page, even if it is only one-pixel square. An applet may require that some initial values be set from the HTML document. One or more param elements can be used to pass parameters to the applet before the applet starts running (provided the applet is written to accept these parameters). param elements go between the start and end tags of an applet element.

Applets are compiled by their authors into class files (filename suffix .class). An applet class file must be in the same directory as, or a subdirectory of, the HTML document that loads the applet. Key attributes of the applet element direct the browser to load a particular class file from the necessary subdirectory.

All user interface design for the applet is programmed into the applet in the Java language. One of the roles of attributes in the applet element is to define the size and other geographical properties of the applet for its rendering on the page. Recent browsers allow JavaScript scripts to communicate with the applet, as well as allowing applets to access document elements (not implemented in Netscape 6).

Note that HTML 4 deprecates the applet element in favor of the more generic object element. Support for embedding applets via the object element is still spotty. Browser support for the applet element will continue for some time to come, however.

Example

<applet code="simpleClock.class" name="myClock" width="400" height="50">
<param name="bgColor" value="black">
<param name="fgColor" value="yellow">
</applet>

Object Model Reference

[window.]document.applets[i]
[window.]document.appletName
[window.]document.getElementById(elementID)

Element-Specific Attributes

align

alt

archive

code

codebase

datafld

datasrc

height

hspace

mayscript

name

object

src

vspace

width

Element-Specific Event Handler Attributes

Handler

NN

IE

HTML

onafterupdate

n/a

4

n/a

onbeforeupdate

n/a

4

n/a

ondataavailable

n/a

4

n/a

ondatasetchanged

n/a

4

n/a

ondatasetcomplete

n/a

4

n/a

onerrorupdate

n/a

4

n/a

onrowenter

n/a

4

n/a

onrowexit

n/a

4

n/a

alignNN 2 IE 3 HTML 3.2

align="alignmentConstant"Optional
The align attribute determines how the rectangle of the applet aligns within the context of surrounding content. See the
Section 8.1.5, earlier in this chapter for description of the possibilities defined in both Navigator and Internet Explorer for this attribute.

Example

<applet code="simpleClock.class" name="myClock" align="absmiddle" 
width="400" height="50"></applet>

Value

Case-insensitive constant value.

Default

bottom

Object Model Reference

[window.]document.applets[i].align
[window.]document.appletName.align 
[window.]document.getElementById(elementID).align
altNN 3 IE 3 HTML 3.2

alt="textMessage"Optional
If a browser does not have the facilities to load and run Java applets or if the browser has Java support turned off in its preferences, the text assigned to the alt attribute is supposed to display in the document where the applet element's tag appears. Typically, this text provides advice on what the page visitor is missing by not being able to load the Java applet. Unlike the noscript or noframes elements, there is no corresponding element for an absent Java applet capability. In practice, browsers don't necessarily display this message for applets that fail to load for a variety of reasons.

Example

<applet code="simpleClock.class" name="myClock" align="absmiddle" 
alt="A Java clock applet." width="400" height="50"></applet>

Value

Any quoted string of characters.

Default

None.

archiveNN 3 IE 6 HTML 4

archive="archiveFileURL"Optional
The precise meaning of the archive attribute varies between the generic HTML 4 recommendation and Netscape's specific implementation. The basic idea behind Netscape's archive attribute is that an author can package multiple class files into a single uncompressed .zip archive file and let the browser load the entire set of classes at one time. This can offer a performance improvement over loading just the main class file (specified by the code attribute) and then letting the class loader fetch each additional class file as needed.

In addition to specifying the archive attribute, be sure to include a code attribute that names the main class to load. Navigator first looks for the presence of that class file in the archive. If the file is missing from the archive, Navigator loads the code class file separately. (That class may then load additional supporting class files individually.) Navigator requires that the archive file have a .zip filename extension. The URL must also be relative to the codebase location.

The HTML specification allows multiple URLs to be specified (in a space-delimited list) for additional class or other resource files. This design anticipates the use of the same attribute with the object element, which the W3C has deemed the successor to the applet element. IE 6 supports the existence of the attribute for compatibility only, but it is not operable.

Example

<applet code="ScriptableClock.class" archive="myClock.zip" width="400" height="50">
</applet>

Value

Case-sensitive URI.

Default

None.

Object Model Reference

[window.]document.applets[i].archive
[window.]document.appletName.archive 
[window.]document.getElementById(elementID).archive
codeNN 2 IE 3 HTML 3.2

code="fileName.class"Required
The name of the main class file that starts and runs the applet. If the codebase attribute is not specified, the code attribute must include a path from the directory that stores the HTML document loading the applet. You might get away with omitting the .class filename extension, but don't take any chances: be complete with the class name. Most servers are case-sensitive, so also match case of the actual class filename.

Example

<applet code="applets/ScriptableClock.class" width="400" height="50">
</applet>

Value

Case-sensitive .class filename or complete path relative to the HTML document.

Default

None.

Object Model Reference

[window.]document.applets[i].code
[window.]document.appletName.code 
[window.]document.getElementById(elementID).code
codebaseNN 2 IE 3 HTML 3.2

codebase="path"Optional
Path to the directory holding the class file designated in either the code or archive attribute. The codebase attribute does not name the class file, just the path. You can make this attribute a complete URL to the directory, but don't try to access a codebase outside of the domain of the current document: security restrictions may prevent the class from loading. A full path and filename can be set together in the code or object attribute, eliminating the need for the codebase attribute setting.

Example

<applet code="ScriptableClock.class" codebase="applets/" width="400" height="50">
</applet>

Value

Case-sensitive pathname, usually relative to the directory storing the current HTML document.

Default

None.

Object Model Reference

[window.]document.applets[i].codeBase
[window.]document.appletName.codeBase
[window.]document.getElementById(elementID).codeBase
datafld, datasrc

See the param element for IE data binding to Java applets.
height, widthNN 2 IE 3 HTML 3.2

Required
width="pixels"
height="pixels"

The size that a Java applet occupies in a document is governed by the height and width attribute settings. Some browser versions might allow you to get away without assigning these attributes, letting the applet's own user interface design determine the height and width of its visible rectangle. As with images, however, it is more efficient for the browser's rendering engine when you explicitly specify the object's dimensions. Make a habit of supplying these values for all applets, as you should for all images or other visible external objects.

Example

<applet code="ScriptableClock.class" width="400" height="50"></applet>

Value

Positive integer pixel values. You cannot entirely hide an applet by setting values to zero, but you can reduce its height and width to one pixel in each dimension. If you want to hide an applet, do so with DHTML by setting its positioning display attribute to none.

Default

None.

Object Model Reference

[window.]document.applets[i].height
[window.]document.appletName.height
[window.]document.getElementById(elementID).height
[window.]document.applets[i].width
[window.]document.appletName.width 
[window.]document.getElementById(elementID).width
hspace, vspaceNN 2 IE 3 HTML 3.2

Optional
hspace="pixels"
vspace="pixels"

You can put some empty space ("air") between an applet and any surrounding content by assigning pixel values to the hspace and vspace attributes. The vspace attribute governs space above and below the applet; the hspace attribute governs space to the left and right of the applet. For browsers that are style sheet savvy, you are perhaps better served by using the padding and/or margin style attributes to gain control down to individual sides, if you so desire.

Example

<applet code="ScriptableClock.class" width="400" height="50" hspace="3" vspace="4">
</applet>

Value

Positive integer pixel values (optionally quoted).

Default

0

Object Model Reference

[window.]document.applets[i].hspace
[window.]document.appletName.hspace
[window.]document.getElementById(elementID).hspace
[window.]document.applets[i].vspace
[window.]document.appletName.vspace 
[window.]document.getElementById(elementID).vspace
idNN n/a IE 4 HTML 4

id="elementIdentifier"Optional
A unique identifier that distinguishes this element from all the rest in the document. Can be used to associate a single element with a style rule naming this attribute value as an ID selector. An element can have an ID assigned for uniqueness as well as a class for inclusion within a group. See
Chapter 3.

If you assign an id attribute and not a name attribute, the value of the id attribute can be used as the applet's name in script reference forms that use the element name (document.appletName).

Example

<applet id="clocker" code="ScriptableClock.class" width="400" height="50">
</applet>

Value

Case-sensitive identifier.

Default

None.

Object Model Reference

[window.]document.applets[i].id
[window.]document.appletName.id 
[window.]document.getElementById(elementID).id
mayscriptNN 3 IE 4 HTML n/a

mayscriptOptional
Navigator 3 introduced a technology called LiveConnect, which allowed scripts to communicate with Java applets and vice versa (not yet implemented in Mozilla-based browsers). For security reasons, an applet's communications facilities with scripts must be explicitly switched on by the page author. By adding the mayscript attribute to the applet's tag, an applet that is written to take advantage of the document objects and scripts can address those items. In other words, the HTML is granting the applet the ability to reach scripts in the document. This attribute is a simple switch: when the attribute name is present, it is turned on.

One more step is required for an applet to communicate with JavaScript. The applet code must import a special Netscape class called JSObject.class. This class file and its companion exception class are built into the Java support in the Windows version of Internet Explorer 4 and later. Although the execution is not perfect in IE, applets can perform basic communication with scripts.

Example

<applet code="ScriptableClock.class" width="400" height="50" mayscript>
</applet>

Value

No value assigned to the attribute. The presence of the attribute name sets turns on applet-to-script communication.

Default

Off.

nameNN 2 IE 3 HTML 3.2

name="elementIdentifier"Optional
If you are scripting an applet, it is usually more convenient to create a reference to the applet by using a unique name you assign to the applet. Then, if you edit the page and move or delete multiple applets on the page, you do not have to worry about adjusting index values to array-style references. In IE 4 and later, you have the option of omitting the name attribute and using the id attribute value in script references to the applet object.

Example

<applet name="clock2" code="ScriptableClock.class" width="400" height="50">
</applet>

Value

Case-sensitive identifier.

Default

None.

Object Model Reference

[window.]document.applets[i].name
[window.]document.appletName.name 
[window.]document.getElementById(elementID).name
objectNN 6 IE n/a HTML 4

object="filename"Optional
Reference to the name of the file (relative to the codebase URI) that preserves the applet's state between sessions. When supported properly, this attribute replaces the code attribute, and the data file points to the applet's startup class file.

Example

<applet name="clock2" object="clockData.dat" width="400" height="50">
</applet>

Value

Case-sensitive filename.

Default

None.

Object Model Reference

[window.]document.applets[i].object
[window.]document.appletName.object 
[window.]document.getElementById(elementID).object
srcNN n/a IE 4 HTML n/a

src="URL"Optional
Internet Explorer defines this attribute as the URL for an "associated file." This may be the same as the archive attribute defined in HTML and Navigator specifications. The src attribute is not a substitute for the code and/or codebase attributes.

Value

A complete or relative URL.

Default

None.

Object Model Reference

[window.]document.applets[i].src
[window.]document.appletName.src
[window.]document.getElementById(elementID).aex
vspace

See hspace.

width

See height.

<area>NN all IE all HTML 3.2

<area>HTML End Tag: Forbidden
A map element defines a client-side image map that is ultimately associated with an image or other object that occupies space on the page. The only job of the map element is to assign a name and a tag context for one or more area element definitions. Each area element defines how the page should respond to user interaction with a specific geographical region of the image or other object.

A client-side image map area can act like an a element link in that an area can link to a destination or javascript: pseudo-URL and assign another frame or window as the target for loading a new document. In fact, in the original scripting document object model, an area element is referenced as a link. It is not uncommon to use client-side area maps in a navigation bar occupying a slender frame of a frameset. This allows an artist to be creative with a menu design, while giving the page author the power to turn any segment of a larger image into a special-purpose link.

Example

<map name="nav">
<area coords="20,30,120,70" href="contents.html" target="display">
<area coords="20,80,145,190" href="contact.html" target="display">
</map>

Object Model Reference

[window.]document.links[i]
[window.]document.getElementById(elementID)

Element-Specific Attributes

alt

coords

href

nohref

shape

target

       

Element-Specific Event Handler Attributes

None.

altNN 6 IE 3 HTML 3.2

alt="textMessage"Required
Nongraphical browsers can use the alt attribute setting to display a brief description of the meaning of the (invisible) image's hotspots. At one time, it was thought that the alt message might be displayed in the browser's status bar by default when the area had focus or the cursor rolled over the area. That function is now typically performed by onmouseover event handlers and scripts. Keep in mind that recent handheld computers usually have nongraphical browsers (or allow graphics to be turned off for improved performance). Don't ignore the graphically impaired.

Example

<area coords="20,30,120,70" href="contents.html" target="display" 
alt="Table of Contents">

Value

Any quoted string of characters.

Default

None.

Object Model Reference

[window.]document.getElementById(elementID).alt 
coordsNN all IE all HTML 3.2

coords="coord1, ... coordN"Optional
Although the formal W3C definition for the coords attribute of an area element states that the attribute is optional, that doesn't mean that you can omit this attribute and expect an area to behave as it should. The coords attribute lets you define the outline of the area to be associated with a particular link or scripted action. Some third-party authoring tools can assist in determining the coordinate points for a hot area. You can also load the image into a graphics program that displays the cursor position in real time and then transfer those values to the coords attribute values.

Coordinate values are entered as a comma-delimited list. If two areas overlap, the area that is defined earlier in the HTML code takes precedence.

Example

<area coords="20,30,120,70" href="contents.html" target="display">

Value

Each coordinate is a length value, but the number of coordinates and their order depend on the shape specified by the shape attribute, which may optionally be associated with the element. For shape="rect", there are four coordinates (left, top, right, bottom); for shape="circle", there are three coordinates (center-x, center-y, radius); for shape="poly", there are two coordinate values for each point that defines the shape of the polygon (x1, y1, x2, y2, x3, y3,...xN, yN).

Default

None.

Object Model Reference

[window.]document.getElementById(elementID).coords 
hrefNN all IE all HTML 3.2

href="URI"Required
The URI of the destination of a link associated with the area. In a browser, when the URI is an HTML document, the document is loaded into the current (default) or other window target (as defined by the target attribute). For some other file types, the browser may load the destination content into a plugin or save the destination file on the client machine. Because IE 3 and Navigator (up to Version 4) treat area elements as a elements, the href attribute must be defined in the area element for scripts in the old DOM to access various properties about the URL and for event handlers (such as onmouseover) to work.

Example

<area coords="20,30,120,70" href="contents.html" target="display">

Value

Any valid URI, including complete and relative URLs, anchors on the same page (anchor names prefaced with the # symbol), and the javascript: pseudo-URL in scriptable browsers to trigger a script statement rather than navigate to a destination.

Default

None.

Object Model Reference

[window.]document.links[i].href
[window.]document.getElementById(elementID).href

Other link object properties allow for the extraction of components of the URL, such as protocol and hostname. See the Link object in Chapter 9.

nohrefNN all IE all HTML 3.2

nohrefOptional
Tells the browser that the area defined by the coordinates has no link associated with it (as not including any href attribute does). When you include this attribute, scriptable browsers no longer treat the element as a link. When an area element lacks an href attribute, the element no longer responds to user events. In IE 4 and later and Netscape 6, you can turn this attribute on and off from a script by setting the corresponding noHref property to true or false.

Example

<area coords="20,30,120,70" nohref>

Value

The presence of this attribute sets its value to true. Extend for XHTML compliance by using nohref="nohref".

Default

Off.

Object Model Reference

[window.]document.getElementById(elementID).noHref 
shapeNN all IE all HTML 3.2

shape="shapeName"Optional
Defines the shape of the client-side area map whose coordinates are specified with the coords attribute. The shape attribute tells the browser how many coordinates to expect.

Example

<area shape="poly" coords="20,20,20,70,65,45" href="contents.html" 
target="display">

Value

Case-insensitive shape constant. Each implementation defines its own set of shape names and equivalents, but there are common denominators across browsers (circle, rect, poly, and polygon).

Shape name

NN

IE

HTML

circ

-

circle

poly

polygon

-

rect

rectangle

-

-

Default

rect

Object Model Reference

[window.]document.getElementById(elementID).shape 
targetNN all IE all HTML 3.2

target="windowOrFrameName"Optional
If the destination document is to be loaded into a window or frame other than the current window or frame, you can specify where the destination document should load by assigning a window or frame name to the target attribute. Target frame names must be assigned to frames and windows as identifiers. Assign names to frames via the name and id attributes of the frame element; assign names to new windows via the second parameter of the window.open( ) scripting method. If you omit this attribute, the destination document replaces the document containing the link. This attribute is applicable only when a value is assigned to the href attribute of the element.

An area element can have only one destination document and one target. If you want a link to change the content of multiple frames, you can use an area element's onclick event handler (check Chapter 9 for supported browser versions) or a javascript: pseudo-URL to fire a script that loads multiple documents. Set the location.href property of each frame to the desired URL.

Strict DTDs for HTML 4 and XHTML do not support the target attribute of any element because frames and windows are outside the scope of pure document markup. In fact, framesetting documents will not validate in the strict environment—thus the purpose of the separate frameset DTDs for HTML 4 and XHTML. If your documents must validate with these strict DTDs, and you wish to support targets, use scripts to set target properties of links, image maps, and forms after the page has loaded.

Example

<area coords="20,30,120,70" href="contents.html" target="display">
<area coords="140,30,180,70" href="index.html" target="_top">

Value

Case-sensitive identifier when the frame or window name has been assigned via the target element's name and id attributes. Four reserved target names act as constants:

_blank
Browser creates a new window for the destination document.

_parent
Destination document replaces the current frame's framesetting document (if one exists; otherwise, it is treated as _self).

_self
Destination document replaces the current document in its window or frame.

_top
Destination document is to occupy the entire browser window, replacing any and all framesets that may be loaded (also treated as _self if there are no framesets defined in the window).

Default

_self

Object Model Reference

[window.]document.links[i].target
[window.]document.getElementById(elementID).target
<b>NN all IE all HTML all

<b>...</b>HTML End Tag: Required
The b element—one of several font style elements in HTML 4—renders its content in a boldface version of the font face governing the next outermost HTML container. You can nest multiple font style elements to create combined styles, such as bold italic (<b><i>bold-italic text</i></b>).

It is up to the browser to fatten boldface display by calculating the character weight or by perhaps loading a bold version of the currently specified font. If you are striving for font perfection, it is best to use style sheets (and perhaps downloadable fonts) to specify a true bold font family, rather than risk the browser's extrapolation of a boldface from a system font. The font-weight CSS style attribute provides quite granular control over the degree of bold applied to text if the font face supports such fine-tuning.

You can take advantage of the containerness of this element by assigning style sheet rules to some or all b elements in a page. For example, you may wish all b elements to be in a red color. By assigning the style rule b {color:red}, you can do it to all elements with only a tiny bit of code.

Although this element is not deprecated in HTML 4 or XHTML 1.0, it would not be surprising to see it lose favor to style sheets in the future.

Example

<p>This product is <b>new</b> and <b>improved</b>!</p>

Object Model Reference

[window.]document.getElementById(elementID)

Element-Specific Attributes

None.

Element-Specific Event Handler Attributes

None.

<base>NN all IE all HTML all

<base>HTML End Tag: Forbidden
A base element is defined inside a document's head element to instruct the browser about the URL path to the current document. This path is used as the basis for all relative URLs used to specify various src and href attributes in the document. The base element's URL should be a complete URL, including the document name (though browsers tend to support URLs to directories, too). The browser calculates the base URL path to the directory holding the document. If you specify <base href="http://www.megacorp.com/products/index.html">, the href attribute of a link on that page to widgets/framitz801.html resolves to the full URL of http://www.megacorp.com/products/widgets/framitz801.html. Similarly, a relative URL can walk up the hierarchy with the dot syntax. For example, from the base element defined earlier, an img element in the index.html page might be set for src="../images/logo.jpg". That reference resolves to http://www.megacorp.com/images/logo.jpg.

By and large, today's browsers automatically calculate the base URL of the currently loaded document, thus allowing use of relative URLs without specifying a base element. This is especially helpful when you are developing pages locally and don't want to change the base element settings when you deploy the pages. The HTML 4 specification states that a document lacking a base element should by default use the current document's URL as the base URL. Of course, this is only for true web pages, rather than HTML-enhanced documents such as email messages, which have no default base URL.

You can also use the base element to define a default target for any link-type element in the document. Therefore, if all links are supposed to load documents into another frame, you can specify this target frame once in the base tag and not worry about target attributes elsewhere in the document. If you wish to override the default for a single link, you may do so by specifying the target attribute for that element (but see the note in the target attribute).

The only attribute this element has in common with other elements is the id attribute.

Example

<head>
<base href="http://www.megacorp.com/index.html" target="_top">
</head>

Object Model Reference

[window.]document.getElementById(elementID)

Element-Specific Attributes

href

target

Element-Specific Event Handler Attributes

None.

hrefNN all IE all HTML all

href="URL"Optional
The href attribute is a URL of a document whose server path is to be used as the base URL for all relative references in the document. This is typically the URL of the current document, but it can be set to another path if it makes sense to your document organization and directory structure.

Example

<base href="http://www.megacorp.com/products/index.html">

Value

This should be a full and absolute URL to a document.

Default

Current document pathname.

Object Model Reference

[window.]document.getElementsByTagName("base")[0].href
[window.]document.getElementById(elementID).href
targetNN all IE all HTML 4

target="windowOrFrameName"Optional
If all or most links and area maps on a page load documents into a separate window or frame, you can set the target attribute of the base element to take care of targeting for all of those elements. You can set the target attribute without setting the href attribute if you want to set only the base target reference.

Strict DTDs for HTML 4 and XHTML do not support the target attribute of any element because frames and windows are outside the scope of pure document markup. In fact, framesetting documents will not validate in the strict environment—thus the purpose of the separate frameset DTDs for HTML 4 and XHTML. If your documents must validate with these strict DTDs, and you wish to support targets, use scripts to set target properties of links, image maps, and forms after the page has loaded.

Example

<base target="rightFrame">

Value

Case-sensitive identifier when the frame or window name has been assigned via the target element's name attribute. Four reserved target names act as constants:

_blank
Browser creates a new window for the destination document.

_parent
Destination document replaces the current frame's framesetting document (if one exists; otherwise, it is treated as _self).

_self
Destination document replaces the current document in its window or frame.

_top
Destination document is to occupy the entire browser window, replacing any and all framesets that may be loaded (also treated as _self if there are no framesets defined in the window).

Default

_self

Object Model Reference

[window.]document.getElementsByTagName("base")[0].target
[window.]document.getElementById(elementID).target
<basefont>NN all IE all HTML 3.2

<basefont>HTML End Tag: Forbidden
A basefont element advises the browser of some font information to be used as the basis for text rendering of the current page below the basefont element. You can apply this element in either the head or body portion of the document (although Microsoft recommends in the body only for IE 4 and later), and you can insert basefont elements as often as is needed to set the base font for a portion of the document. Be aware that basefont element settings do not necessarily apply to content in tables. If you want table content to resemble a custom basefont setting, you likely have to set the font styles to table elements separately.

The basefont element overrides the default font settings in the browser's user preferences settings. Like most font-related elements, the basefont element is deprecated in HTML 4 in favor of style sheets, and is removed from the HTML 4 and XHTML strict DTDs.

Example

<basefont face="Times, serif" size="4">

Element-Specific Attributes

color

face

name

size

Element-Specific Event Handler Attributes

None.

colorNN 6 IE 3 HTML 4

color="colorTripletOrName"Optional
Sets the font color of all text below the basefont element. Deprecated in HTML 4 in favor of the color CSS attribute.

Example

<basefont color="Olive">

Value

A hexadecimal triplet or plain-language color name. See Appendix A for acceptable plain-language color names.

Default

Browser default.

Object Model Reference

[window.]document.getElementsByTagName("basefont")[0].color
faceNN 6 IE 4 HTML 4

face="fontFaceName1[, ... fontFaceNameN]"Optional
You can assign a hierarchy of font faces to use for the default font of a section headed by a basefont element. The browser looks for the first font face in the comma-delimited list of font face names until it either finds a match in the client system or runs out of choices, at which point the browser default font face is used. Font face names must match the system font face names exactly. If you use this attribute (instead of the preferred style sheet attribute), you can always suggest a generic font face (serif, sans-serif) as the final choice. Deprecated in HTML 4 in favor of the font-family CSS attribute.

In IE 3, this attribute was called the name attribute.

Example

<basefont face="Bookman, Times Roman, serif">

Value

One or more font face names, including the recognized generic faces: serif | sans-serif | cursive | fantasy | monospace.

Default

Browser default.

Object Model Reference

[window.]document.getElementsByTagName("basefont")[0].face
nameNN n/a IE |3| HTML n/a

name="fontFaceName"Optional
This was IE 3's version of what is today the face attribute. It accepts a single font face as a value. The name attribute is no longer used.

Value

A single font face name.

Default

Browser default.

sizeNN 6 IE all HTML 3.2

size="integerOrRelativeSize"Optional
Font sizes referenced by the size attribute are on a relative size scale that is not tied to any one point size across operating system platforms. The default browser font size is 3. The range of acceptable values for the size attribute are integers from 1 to 7 inclusive. The exact point size varies with the operating system and browser design.

Users can often adjust the default font size in preferences settings. The size attribute overrides that setting. Moreover, size values can be relative to whatever font size is set in the preferences. By preceding an attribute value with a + or - sign, the browser's default size can be adjusted upward or downward, but always within the range of 1 through 7.

Example

<basefont size="4">
<basefont size="+3">

Value

Either an integer or relative value, consisting of a + or - symbol and an integer value.

Default

3

Object Model Reference

[window.]document.getElementsByTagName("basefont")[0].size 
<bdo>NN 6 IE 5 HTML 4

<bdo>...</bdo>HTML End Tag: Required
The name of the bdo element stands for bidirectional override. The lang and dir attributes of most elements are designed to take care of most situations involving the mixture of writing systems that compose text in opposite directions. The bdo element is designed to assist in instances when the normal bidirectional algorithms must be explicitly overridden, due to various conversions during text processing. Because this element is not yet implemented in browsers, it is detailed here for informational purposes only.

Example

<bdo dir="ltr">someMixedScriptTextHere</bdo>

Element-Specific Attributes

None.

Element-Specific Event Handler Attributes

None.

<bgsound>NN n/a IE 3 HTML n/a

<bgsound>HTML End Tag: Optional
This Internet Explorer-only attribute lets you define a sound file that is to play in the background while the user visits the page. The element is allowed only inside the head element. With scripting, you can control the volume and how many times the sound track plays even after the sound file loads. Although an end tag is optional, there is no need for it because all specifications for the sound are maintained by attributes in the start tag. Only the id attribute is shared with other elements.

If you are going to use this tag, I strongly recommend making the background sound a user-selectable choice that is turned off by default. In office environments, it can be startling (if not embarrassing) to have background music or sounds unexpectedly emanate from a computer. Also be aware that there is likely to be some delay in the start of the music due to download time.

Example

<bgsound src="tunes/mazeppa.mid">

Object Model Reference

[window.]document.getElementById(elementID)

Element-Specific Attributes

balance

loop

src

volume

Element-Specific Event Handler Attributes

None.

balanceNN n/a IE 4 HTML n/a

balance="signedInteger"Optional
A value that directs how the audio is divided between the left and right speakers. Once this attribute value is set in the element, its value cannot be changed by script control.

Example

<bgsound src="tunes/mazeppa.mid" balance="+2500">

Value

A signed integer between -10,000 and +10,000. A value of 0 is equally balanced on both sides. A negative value gives a relative boost to the left side; a positive value boosts the right side.

Default

0

Object Model Reference

[window.] document.getElementsByTagName("bgsound")[0].balance
loopNN n/a IE 3 HTML n/a

loop="integer"Optional
Defines the number of times the sound plays. If the attribute is absent or is present with any value other than -1, the sound plays at least once. Assigning a value of -1 means that the sound plays until the page is unloaded. Contrary to Microsoft's Internet Explorer SDK information, there does not appear to be a way to precache the sound without having it start playing.

Example

<bgsound src="tunes/mazeppa.mid" loop="3">

Value

No value assignment necessary for a single play. A value of 0 still causes a single play. Values above zero play the sound the specified number of times. Assign -1 to have the sound play indefinitely.

Default

-1

Object Model Reference

[window.] document.getElementsByTagName("bgsound")[0].loop
srcNN n/a IE 3 HTML n/a

src="URL"Optional
A URL that points to the sound file to be played. The type of sound file that can be played is limited only by the audio facilities of the browser. Common audio formats, including MIDI, are supported in Internet Explorer without further plugin installation.

Example

<bgsound src="tunes/beethoven.mid">

Value

Any valid URL, including complete and relative URLs. The file must be in a MIME type supported by Internet Explorer or a plugin.

Default

None.

Object Model Reference

[window.] document.getElementsByTagName("bgsound")[0].src
volumeNN n/a IE 4 HTML n/a

volume="signedInteger"Optional
An integer that defines how loud the background sound plays relative to the maximum sound output level as adjusted by user preferences in the client computer. Maximum volume—a setting of zero—is only as loud as the user has set in the Sound control panel. Attribute adjustments are negative values as low as -10,000 (although most users lose the sound at a value much higher than -10,000).

Example

<bgsound src="tunes/beethoven.mid" volume="-500">

Value

A signed integer value between -10,000 and 0.

Default

0

Object Model Reference

[window.] document.getElementsByTagName("bgsound")[0].volume
<big>NN all IE all HTML 3.2

<big>...</big>HTML End Tag: Required
The big element—one of several font style elements in HTML 4—renders its content in the next font size (in HTML's 1 through 7 scale) larger than the previous body font size. If you nest big elements, the effects on the more nested elements are cumulative, with each nested level rendered one size larger than the next outer element. Default font size is dependent upon the browser, operating system, and user preferences settings. For more precise font size rendering, use style sheet rules.

Example

<p>This product is <big>new</big> and <big>improved</big>!</p>

Object Model Reference

[window.]document.getElementById(elementID)

Element-Specific Attributes

None.

Element-Specific Event Handler Attributes

None.

<blink>NN <6 IE n/a HTML n/a

<blink>...</blink>HTML End Tag: Required
The blink element is Marc Andreessen's contribution to horrifying web pages. All content of the element flashes on and off uncontrollably in a distracting manner. The more content you place inside the element, the more difficult it is to read between the flashes. Please don't use this tag. I beg you. This element does not have any attributes or event handlers, and it did not survive the migration to Version 6.

Example

<blink>I dare you to read this...and not look at it.</blink>
<blockquote>NN all IE all HTML all

<blockquote>...</blockquote>HTML End Tag: Required
The blockquote element is intended to set off a long quote inside a document. Traditionally, the blockquote element has been rendered as an indented block, with wider left and right margins (about 40 pixels each), plus some extra whitespace above and below the block. Browsers will likely continue this type of rendering, although you are encouraged to use style sheets to create such displays (with or without the blockquote element). For inline quotations, see the q element.

Example

<blockquote>Four score and seven years ago...
shall not perish from the earth</blockquote>

Object Model Reference

[window.]document.getElementById(elementID)

Element-Specific Attributes

cite

Element-Specific Event Handler Attributes

None.

citeNN 6 IE 6 HTML 4

cite="URL"Optional
A URL pointing to an online source document from which the quotation is taken. This is not in any way a mechanism for copying or extracting content from another document. Presumably, this HTML 4 recommendation is to encourage future browsers and search engines to utilize a reference to online source material for the benefit of readers and surfers. The Properties choice for Netscape 6's context menu for this element displays a small window that includes an active link to the URL assigned to the attribute. Version 6 browsers provide no other functionality for this attribute.

Value

Any valid URL to a document on the World Wide Web, including absolute or relative URLs.

Default

None.

Element-Specific Event Handler Attributes

None.

<body>NN all IE all HTML all

<body>...</body>HTML End Tag: Optional
After all of the prefatory material in the head portion of an HTML file, the body element contains the genuine content of the page that the user sees in the browser window (or may hear from browsers that know how to speak to users). Before style sheets, the body element was the place where page authors could specify document-wide color and background schemes. A great many favorite attributes covering these properties are deprecated in HTML 4, in favor of style sheet rules that may be applied to the body element. Support for all these attributes, however, will remain in mainstream browsers for years to come.

The body element is also where window object event handler attributes are placed. For example, a window object as defined in most document object models has an onload event handler that fires when a document has finished loading into the current window or frame. Assigning that event handler as an element attribute is done in the body element.

Although it may appear from a variety of implications that the body element is the document object, this is not true. The document object has additional properties (such as the document.title) that are defined outside of the body element in an HTML document. In a W3C-DOM-aware browser, the document node tree puts more distance between the root document node and the body element: the document node is the parent of the html element; the html element is the parent of both the head and body elements.

Example

<body background="watermark.jpg" onLoad="init( );">
...
</body>

Object Model Reference

[window.]document.body

Element-Specific Attributes

alink

background

bgcolor

bgproperties

bottommargin

leftmargin

link

marginheight

marginwidth

nowrap

rightmargin

scroll

text

topmargin

vlink

Element-Specific Event Handler Attributes

Handler

NN

IE

HTML

onafterprint

n/a

5

n/a

onbeforeprint

n/a

5

n/a

onload

2

3

4

onresize

4

4

n/a

onscroll

n/a

4

n/a

onselect

n/a

4

n/a

onunload

2

3

4

alinkNN all IE all HTML 3.2

alink="colorTripletOrName"Optional
Establishes the color of a hypertext link when it is activated (being clicked on) by the user. This is one of three states for a link: unvisited, active, and visited. The color is applied to the link text or border around an image or object embedded within an a element. This attribute is deprecated in favor of the CSS :active pseudo-class style rule for an a element, as described in
Chapter 11.

Example

<body alink="#FF0000">...</body>

Value

A hexadecimal triplet or plain-language color name. See Appendix A for acceptable plain-language color names.

Default

#FF0000 (typically).

Object Model Reference

[window.]document.alinkColor
[window.]document.body.aLink
backgroundNN all IE all HTML 3.2

background="URL"Optional
Specifies an image file that is used as a backdrop to the text and other content of the page. Unlike normal images that get loaded into browser content, a background image loads in its original size (without scaling) and tiles to fill the available document space in the browser window or frame. Smaller images usually download faster but are obviously repeated more often in the background. Animated GIFs are also allowable but very distracting to the reader. When selecting a background image, be sure it is very muted in comparison to the main content so that the content stands out clearly. Background images, if used at all, should be extremely subtle or occupy space free of other content.

This attribute is deprecated in HTML 4 in favor of the background style attribute.

Example

<body background="watermark.jpg">...</body>

Value

Any valid URL to an image file, including complete and relative URLs.

Default

None.

Object Model Reference

[window.]document.body.background
bgcolorNN all IE all HTML 3.2

bgcolor="colorTripletOrName"Optional
Establishes a fill color (behind the text and other content) for the entire document. If you combine a bgcolor and background, any transparent areas of the background image let the background color show through. This attribute is deprecat