DekGenius.com
Team LiB   Previous Section   Next Section
HTMLBodyElement the <body> of an HTML document

Availability

DOM Level 1 HTML

Inherits from/Overrides

Node figs/U2192.gif Element figs/U2192.gif HTMLElement figs/U2192.gif HTMLBodyElement

Properties

deprecated String aLink

The value of the alink attribute. Specifies the color of "active" links; that is, the color of a link when the mouse has been pressed over it but has not yet been released.

deprecated String background

The value of the background attribute. Specifies the URL of an image to use as a background texture for the document.

deprecated String bgColor

The value of the bgcolor attribute. Specifies the background color of the document.

deprecated String link

The value of the link attribute. Specifies the normal color of unvisited hyperlinks.

deprecated String text

The value of the text attribute. Specifies the foreground color (the color of text) for the document.

deprecated String vLink

The value of the vlink attribute. Specifies the normal color of "visited" hyperlinks that have already been followed.

Description

The HTMLBodyElement interface represents the <body> tag of a document. All HTML documents have a <body> tag, even if it does not explicitly appear in the document source. You can obtain the HTMLBodyElement of a document through the body property of the HTMLDocument interface.

The properties of this object specify default colors and images for the document. Although these properties represent the values of <body> attributes, the Level 0 DOM made these same values accessible through properties (with different names) of the Document object. See the Document object in the client-side reference section of this book for details.

Although these color and image properties belong more appropriately to the HTMLBodyElement interface than they do to the Document object, note that they are all deprecated because the HTML 4 standard deprecates the <body> attributes that they represent. The preferred way to specify colors and images for a document is using CSS styles.

Example

document.body.text = "#ff0000";         // Display text in bright red
document.fgColor = "#ff0000";           // Same thing using old DOM Level 0 API
document.body.style.color = "#ff0000";  // Same thing using CSS styles

See Also

Document object in the client-side reference section

    Team LiB   Previous Section   Next Section