HTMLBodyElement

The HTMLBodyElement interface provides special properties (beyond those inherited from the regular HTMLElement interface) for manipulating <body> elements.

EventTarget Node Element HTMLElement HTMLBodyElement

Properties

Inherits properties from its parent, HTMLElement and from WindowEventHandlers.

Is a DOMString that represents the color of active hyperlinks.

HTMLBodyElement.background

Is a DOMString that represents the description of the location of the background image resource. Note that this is not an URI, though some older version of some browsers do expect it.

HTMLBodyElement.bgColor

Is a DOMString that represents the background color for the document.

Is a DOMString that represents the color of unvisited links.

HTMLBodyElement.text

Is a DOMString that represents the foreground color of text.

Is a DOMString that represents the color of visited links.

Methods

No specific methods; inherits methods from its parent, HTMLElement, and from WindowEventHandlers.

Event handlers

No specific event handlers; inherits event handlers from its parent, HTMLElement and from WindowEventHandlers.

WindowEventHandlers.onafterprint

Is an event handler representing the code to be called when the afterprint event is raised.

WindowEventHandlers.onbeforeprint

Is an event handler representing the code to be called when the beforeprint event is raised.

WindowEventHandlers.onbeforeunload

Is an event handler representing the code to be called when the beforeunload event is raised.

WindowEventHandlers.onhashchange

Is an event handler representing the code to be called when the hashchange event is raised.

WindowEventHandlers.onlanguagechange

Is an event handler representing the code to be called when the languagechange event is raised.

WindowEventHandlers.onoffline

Is an event handler representing the code to be called when the offline event is raised.

WindowEventHandlers.ononline

Is an event handler representing the code to be called when the online event is raised.

WindowEventHandlers.onpagehide

Is an event handler representing the code to be called when the pagehide event is raised.

WindowEventHandlers.onpageshow

Is an event handler representing the code to be called when the pageshow event is raised.

WindowEventHandlers.onpopstate

Is an event handler representing the code to be called when the popstate event is raised.

WindowEventHandlers.onrejectionhandled

An event handler representing the code executed when the rejectionhandled event is raised, indicating that a Promise was rejected and the rejection has been handled.

GlobalEventHandlers.onresize

Is an event handler representing the code to be called when the resize event is raised.

WindowEventHandlers.onstorage

Is an event handler representing the code to be called when the storage event is raised.

WindowEventHandlers.onunhandledrejection

An event handler representing the code executed when the unhandledrejection event is raised, indicating that a Promise was rejected but the rejection was not handled.

WindowEventHandlers.onunload

Is an event handler representing the code to be called when the unload event is raised.

Specifications

Specification
HTML Standard
# htmlbodyelement

Browser compatibility

BCD tables only load in the browser

See also