![]() | ![]() |
| <a> | NN all IE all HTML all |
| <a>...</a> | HTML End Tag: Required |
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.
<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>
[window.]document.links[i] [window.]document.anchors[i] [window.]document.getElementById(elementID)
| charset | coords | datafld | datasrc | href |
| hreflang | methods | name | rel | rev |
| shape | target | type | urn |
None. Anchor-only a elements have no event handlers in Navigator through Version 4.
charset NN 6 IE n/a HTML 4 Character encoding of the content at the other end of the link.
charset="characterSet" Optional 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.
coords NN n/a IE 6 HTML 4 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.
coords="coord1, ... coordN" Optional
datafld NN n/a IE 4 HTML n/a 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.
datafld="columnName" Optional 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
datasrc NN n/a IE 4 HTML n/a 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.
datasrc="dataSourceName" Optional 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
href NN all IE all HTML all 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).
href="URI" Required for links 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).hrefIn 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.
hreflang NN 6 IE 6 HTML 4 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.
hreflang="languageCode" Optional Example
<a hreflang="HI" href="hindi/Chap3.html>Chapter 3 (in Hindi)</a>Value
Case-insensitive language code.
Default
Browser default.
methods NN n/a IE 4 HTML n/a 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.
methods="http-method" Optional 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
name NN all IE all HTML all 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.
name="elementIdentifier" Required for anchors 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
rel NN 6 IE 3 HTML 4 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.
rel="linkTypes" Optional 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
rev NN 6 IE 3 HTML 4 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.
rev="linkTypes" Optional 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
shape NN n/a IE n/a HTML 4 Defines the shape of a server-side image map area whose coordinates are specified with the coords attribute. See the area element.
shape="shape" Optional
target NN all IE all HTML all 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.
target="windowOrFrameName" Optional 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
type NN 6 IE 6 HTML 4 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.
type="MIMEType" Optional 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.
urn NN n/a IE 4 HTML n/a 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.
urn="urn" Optional 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 |
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.
Ottumwa, <abbr title="Iowa">IA</abbr> 55334<br> <abbr lang="de" title="und so weiter">usw.</abbr>
[window.]document.getElementById(elementID)
None.
None.
| <acronym> | NN 6 IE 4 HTML 4 |
| <acronym>...</acronym> | HTML End Tag: Required |
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.
<acronym title="General Agreement on Tariffs and Trade">GATT</acronym> <acronym lang="it" title="Stati Uniti">s.u.</acronym>
[window.]document.getElementById(elementID)
None.
None.
| <address> | NN all IE all HTML all |
| <address>...</address> | HTML End Tag: Required |
<address> <p>Send comments to:<a href="mailto:jb@megacorp.com">jb@megacorp.com</a> </p> </address>
[window.]document.getElementById(elementID)
None.
None.
| <applet> | NN 2 IE 3 HTML 3.2 |
| <applet>...</applet> | HTML End Tag: Required |
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.
<applet code="simpleClock.class" name="myClock" width="400" height="50"> <param name="bgColor" value="black"> <param name="fgColor" value="yellow"> </applet>
[window.]document.applets[i] [window.]document.appletName [window.]document.getElementById(elementID)
|
align |
alt |
archive |
code |
codebase |
|
datafld |
datasrc |
height |
hspace |
mayscript |
|
name |
object |
src |
vspace |
width |
|
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 |
align NN 2 IE 3 HTML 3.2 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.
align="alignmentConstant" Optional 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
alt NN 3 IE 3 HTML 3.2 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.
alt="textMessage" Optional 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.
archive NN 3 IE 6 HTML 4 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.
archive="archiveFileURL" Optional 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
code NN 2 IE 3 HTML 3.2 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.
code="fileName.class" Required 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
codebase NN 2 IE 3 HTML 3.2 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.
codebase="path" Optional 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, width NN 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, vspace NN 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
id NN n/a IE 4 HTML 4 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.
id="elementIdentifier" Optional 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
mayscript NN 3 IE 4 HTML n/a 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.
mayscript Optional 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.
name NN 2 IE 3 HTML 3.2 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.
name="elementIdentifier" Optional 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
object NN 6 IE n/a HTML 4 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.
object="filename" Optional 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
src NN n/a IE 4 HTML n/a 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.
src="URL" Optional 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 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.
<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>
[window.]document.links[i] [window.]document.getElementById(elementID)
|
alt |
coords |
href |
nohref |
shape |
|
target |
None.
alt NN 6 IE 3 HTML 3.2 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.
alt="textMessage" Required 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
coords NN all IE all HTML 3.2 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.
coords="coord1, ... coordN" Optional 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
href NN all IE all HTML 3.2 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.
href="URI" Required 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).hrefOther link object properties allow for the extraction of components of the URL, such as protocol and hostname. See the Link object in Chapter 9.
nohref NN all IE all HTML 3.2 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.
nohref Optional 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
shape NN all IE all HTML 3.2 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.
shape="shapeName" Optional 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
target NN all IE all HTML 3.2 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.
target="windowOrFrameName" Optional 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 |
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.
<p>This product is <b>new</b> and <b>improved</b>!</p>
[window.]document.getElementById(elementID)
None.
None.
| <base> | NN all IE all HTML all |
| <base> | HTML End Tag: Forbidden |
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.
<head> <base href="http://www.megacorp.com/index.html" target="_top"> </head>
[window.]document.getElementById(elementID)
|
href |
target |
None.
href NN all IE all HTML all 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.
href="URL" Optional 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
target NN all IE all HTML 4 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.
target="windowOrFrameName" Optional 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 |
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.
<basefont face="Times, serif" size="4">
|
color |
face |
name |
size |
None.
color NN 6 IE 3 HTML 4 Sets the font color of all text below the basefont element. Deprecated in HTML 4 in favor of the color CSS attribute.
color="colorTripletOrName" Optional 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
face NN 6 IE 4 HTML 4 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.
face="fontFaceName1[, ... fontFaceNameN]" Optional 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
name NN n/a IE |3| HTML n/a 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.
name="fontFaceName" Optional Value
A single font face name.
Default
Browser default.
size NN 6 IE all HTML 3.2 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.
size="integerOrRelativeSize" Optional 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 |
<bdo dir="ltr">someMixedScriptTextHere</bdo>
None.
None.
| <bgsound> | NN n/a IE 3 HTML n/a |
| <bgsound> | HTML End Tag: Optional |
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.
<bgsound src="tunes/mazeppa.mid">
[window.]document.getElementById(elementID)
|
balance |
loop |
src |
volume |
None.
balance NN n/a IE 4 HTML n/a 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.
balance="signedInteger" Optional 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
loop NN n/a IE 3 HTML n/a 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.
loop="integer" Optional 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
src NN n/a IE 3 HTML n/a 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.
src="URL" Optional 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
volume NN n/a IE 4 HTML n/a 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).
volume="signedInteger" Optional 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 |
<p>This product is <big>new</big> and <big>improved</big>!</p>
[window.]document.getElementById(elementID)
None.
None.
| <blink> | NN <6 IE n/a HTML n/a |
| <blink>...</blink> | HTML End Tag: Required |
<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 |
<blockquote>Four score and seven years ago... shall not perish from the earth</blockquote>
[window.]document.getElementById(elementID)
|
cite |
None.
cite NN 6 IE 6 HTML 4 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.
cite="URL" Optional 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 |
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.
<body background="watermark.jpg" onLoad="init( );"> ... </body>
[window.]document.body
|
alink |
background |
bgcolor |
bgproperties |
bottommargin |
|
leftmargin |
link |
marginheight |
marginwidth |
nowrap |
|
rightmargin |
scroll |
text |
topmargin |
vlink |
|
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 |
alink NN all IE all HTML 3.2 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.
alink="colorTripletOrName" Optional 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
background NN all IE all HTML 3.2 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.
background="URL" Optional 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
bgcolor NN all IE all HTML 3.2 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
bgcolor="colorTripletOrName" Optional