HTMLBodyElement
The HTMLBodyElement interface provides special properties (beyond those inherited from the regular HTMLElement interface) for manipulating <body> elements.
Properties
Inherits properties from its parent, HTMLElement and from WindowEventHandlers.
HTMLBodyElement.aLink- Is a
DOMStringthat represents the color of active hyperlinks. HTMLBodyElement.background- Is a
DOMStringthat 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
DOMStringthat represents the background color for the document. HTMLBodyElement.link- Is a
DOMStringthat represents the color of unvisited links. HTMLBodyElement.text- Is a
DOMStringthat represents the foreground color of text. HTMLBodyElement.vLink- Is a
DOMStringthat 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
EventHandlerrepresenting the code to be called when theafterprintevent is raised. WindowEventHandlers.onbeforeprint- Is an
EventHandlerrepresenting the code to be called when thebeforeprintevent is raised. WindowEventHandlers.onbeforeunload- Is an
EventHandlerrepresenting the code to be called when thebeforeunloadevent is raised. WindowEventHandlers.onhashchange- Is an
EventHandlerrepresenting the code to be called when thehashchangeevent is raised. WindowEventHandlers.onlanguagechange- Is an
EventHandlerrepresenting the code to be called when thelanguagechangeevent is raised. WindowEventHandlers.onmessage- Is an
EventHandlercalled whenever an object receives amessageevent. WindowEventHandlers.onmessageerror- Is an
eventHandlercalled whenever an object receives amessageerrorevent. WindowEventHandlers.onoffline- Is an
EventHandlerrepresenting the code to be called when theofflineevent is raised. WindowEventHandlers.ononline- Is an
EventHandlerrepresenting the code to be called when theonlineevent is raised. WindowEventHandlers.onpagehide- Is an
EventHandlerrepresenting the code to be called when thepagehideevent is raised. WindowEventHandlers.onpageshow- Is an
EventHandlerrepresenting the code to be called when thepageshowevent is raised. WindowEventHandlers.onpopstate- Is an
EventHandlerrepresenting the code to be called when thepopstateevent is raised. WindowEventHandlers.onrejectionhandled- An
EventHandlerrepresenting the code executed when therejectionhandledevent is raised, indicating that aPromisewas rejected and the rejection has been handled. GlobalEventHandlers.onresize- Is an
EventHandlerrepresenting the code to be called when theresizeevent is raised. WindowEventHandlers.onstorage- Is an
EventHandlerrepresenting the code to be called when thestorageevent is raised. WindowEventHandlers.onunhandledrejection- An
EventHandlerrepresenting the code executed when theunhandledrejectionevent is raised, indicating that aPromisewas rejected but the rejection was not handled. WindowEventHandlers.onunload- Is an
EventHandlerrepresenting the code to be called when theunloadevent is raised.
Specifications
| Specification | Status | Comment |
|---|---|---|
| HTML Living Standard The definition of 'HTMLBodyElement' in that specification. |
Living Standard | Technically, the event-related properties onafterprint, onbeforeprint, onbeforeunload, onblur, onerror, onfocus, onhashchange, onlanguagechange, onload, onmessage, onoffline, ononline, onpopstate, onresize, onstorage, and onunload, have been moved to WindowEventHandlers. HTMLBodyElement implements this interface. |
| HTML 5.1 The definition of 'HTMLBodyElement' in that specification. |
Recommendation | |
| HTML5 The definition of 'HTMLBodyElement' in that specification. |
Recommendation | The following properties are now obsolete: aLink, bgColor, background, link, text, and vLink.The following properties have been added: onafterprint, onbeforeprint, onbeforeunload, onblur, onerror, onfocus, onhashchange, onload, onmessage, onoffline, ononline, onpopstate, onresize, onstorage, and onunload. |
| Document Object Model (DOM) Level 2 HTML Specification The definition of 'HTMLBodyElement' in that specification. |
Obsolete | No change from Document Object Model (DOM) Level 1 Specification. |
| Document Object Model (DOM) Level 1 Specification The definition of 'HTMLBodyElement' in that specification. |
Obsolete | Initial definition. |
Browser compatibility
BCD tables only load in the browser
See also
- HTML element implementing this interface:
<body> WindowEventHandlers

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.
