Firefox Tomorrow

web api interface

HTMLBodyElement

View on MDN ↗

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

Instance properties

Inherits properties from its parent, HTMLElement.

  • aLink Deprecated
    • : A string that represents the color of active hyperlinks.
  • background Deprecated
    • : A string that represents the description of the location of the background image resource. Note that this is not a URI, though some older version of some browsers do expect it.
  • bgColor Deprecated
    • : A string that represents the background color for the document.
  • link Deprecated
    • : A string that represents the color of unvisited links.
  • text Deprecated
    • : A string that represents the foreground color of text.
  • vLink Deprecated
    • : A string that represents the color of visited links.

Instance methods

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

Event handlers

The HTMLElement events are inherited.

The following Window onXYZ event handler properties are also available as aliases targeting the window object. However, it is advised to listen to them on the window object directly rather than on HTMLBodyElement.

[!NOTE] Using addEventListener() on HTMLBodyElement will not work for the onXYZ event handlers listed below. Listen to the events on the window object instead.

Note that while onblur, onerror, onfocus, onload, onresize, and onscroll are available on any element, their meanings on the <body> element are not the same as on other elements. They listen for events on the window object instead.

Specifications

SpecificationsStandards references are available on the canonical MDN page.

Browser compatibility

Browser compatibilityCompatibility data is available on the canonical MDN page.

See also

  • HTML element implementing this interface: <body>