The HTMLBodyElement interface provides special properties (beyond those of the regular HTMLElement interface they also inherit) for manipulating body elements.
Inherits properties from its parent, HTMLElement and from WindowEventHandlers.
HTMLBodyElement.aLink
DOMString that represents the color of active hyperlinks.HTMLBodyElement.background
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
DOMString that represents the background color for the document.HTMLBodyElement.link
DOMString that represents the color of unvisited links.HTMLBodyElement.text
DOMString that represents the foreground color of text.HTMLBodyElement.vLink
DOMString that represents the color of visited links.No specific methods; inherits methods from its parent, HTMLElement and from WindowEventHandlers.
No specific event handlers; inherits event handlers from its parent, HTMLElement and from WindowEventHandlers.
WindowEventHandlers.onafterprintEventHandler representing the code to be called when the afterprint event is raised.WindowEventHandlers.onbeforeprintEventHandler representing the code to be called when the beforeprint event is raised.WindowEventHandlers.onbeforeunloadEventHandler representing the code to be called when the beforeunload event is raised.WindowEventHandlers.onhashchangeEventHandler representing the code to be called when the hashchange event is raised.WindowEventHandlers.onlanguagechange
EventHandler representing the code to be called when the languagechange event is raised.WindowEventHandlers.onmessageEventHandler called whenever an object receives a message event. WindowEventHandlers.onmessageerroreventHandler called whenever an object receives a messageerror event.WindowEventHandlers.onofflineEventHandler representing the code to be called when the offline event is raised.WindowEventHandlers.ononlineEventHandler representing the code to be called when the online event is raised.WindowEventHandlers.onpagehideEventHandler representing the code to be called when the pagehide event is raised.WindowEventHandlers.onpageshowEventHandler representing the code to be called when the pageshow event is raised.WindowEventHandlers.onpopstateEventHandler representing the code to be called when the popstate event is raised.WindowEventHandlers.onrejectionhandledEventHandler representing the code executed when the rejectionhandled event is raised, indicating that a Promise was rejected and the rejection has been handled.WindowEventHandlers.onresizeEventHandler representing the code to be called when the resize event is raised.WindowEventHandlers.onstorageEventHandler representing the code to be called when the storage event is raised.WindowEventHandlers.onunhandledrejectionEventHandler representing the code executed when the unhandledrejection event is raised, indicating that a Promise was rejected but the rejection was not handled.WindowEventHandlers.onunloadEventHandler representing the code to be called when the unload event is raised.| 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. |
| Desktop | ||||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
| Basic support | 1 | Yes | 1 | 4 | Yes | Yes |
aLink
|
1 | 12 | 1 | 4 | Yes | Yes |
background
|
1 | 12 | 1 | 4 | Yes | Yes |
bgColor
|
1 | 12 | 1 | 4 | Yes | Yes |
link
|
1 | 12 | 1 | 4 | Yes | Yes |
text
|
1 | 12 | 1 | 4 | Yes | Yes |
vLink
|
1 | 12 | 1 | 4 | Yes | Yes |
| Mobile | |||||||
|---|---|---|---|---|---|---|---|
| Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
| Basic support | Yes | Yes | Yes | 4 | Yes | Yes | Yes |
aLink
|
Yes | Yes | Yes | 4 | Yes | Yes | Yes |
background
|
Yes | Yes | Yes | 4 | Yes | Yes | Yes |
bgColor
|
Yes | Yes | Yes | 4 | Yes | Yes | Yes |
link
|
Yes | Yes | Yes | 4 | Yes | Yes | Yes |
text
|
Yes | Yes | Yes | 4 | Yes | Yes | Yes |
vLink
|
Yes | Yes | Yes | 4 | Yes | Yes | Yes |
<body>
WindowEventHandlers
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/HTMLBodyElement