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.onafterprint
EventHandler
representing the code to be called when the afterprint
event is raised.WindowEventHandlers.onbeforeprint
EventHandler
representing the code to be called when the beforeprint
event is raised.WindowEventHandlers.onbeforeunload
EventHandler
representing the code to be called when the beforeunload
event is raised.WindowEventHandlers.onhashchange
EventHandler
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.onmessage
EventHandler
representing the code to be called when the message
event is raised.WindowEventHandlers.onoffline
EventHandler
representing the code to be called when the offline
event is raised.WindowEventHandlers.ononline
EventHandler
representing the code to be called when the online
event is raised.WindowEventHandlers.onpagehide
EventHandler
representing the code to be called when the pagehide
event is raised.WindowEventHandlers.onpageshow
EventHandler
representing the code to be called when the pageshow
event is raised.WindowEventHandlers.onpopstate
EventHandler
representing the code to be called when the popstate
event is raised.WindowEventHandlers.onrejectionhandled
EventHandler
representing the code executed when the rejectionhandled
event is raised, indicating that a Promise
was rejected and the rejection has been handled.WindowEventHandlers.onresize
EventHandler
representing the code to be called when the resize
event is raised.WindowEventHandlers.onstorage
EventHandler
representing the code to be called when the storage
event is raised.WindowEventHandlers.onunhandledrejection
EventHandler
representing the code executed when the unhandledrejection
event is raised, indicating that a Promise
was rejected but the rejection was not handled.WindowEventHandlers.onunload
EventHandler
representing the code to be called when the unload
event is raised.Specification | Status | Comment |
---|---|---|
WHATWG 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. |
HTML5.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. | Recommendation | No change from Document Object Model (DOM) Level 1 Specification. |
Document Object Model (DOM) Level 1 Specification The definition of 'HTMLBodyElement' in that specification. | Recommendation | Initial definition. |
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|---|
Basic support | 1.0 | (Yes) | 1.0 (1.7 or earlier) [1] | 4.0 | (Yes) [1] | (Yes) |
onXYZ event handlers | (Yes) | ? | (Yes) | ? | ? | ? |
onlanguage | ? | ? | 32 (32) | ? | ? | ? |
onstorage | ? | ? | 45 (45) | ? | ? | ? |
onrejectionhandled and onunhandledrejection
| 49 | ? | No support | No support | No support | No support |
Feature | Android | Edge | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Basic support | (Yes) | (Yes) | 1.0 (1.0) | (Yes) | (Yes) | (Yes) |
onXYZ event handlers | (Yes) | ? | (Yes) | ? | ? | ? |
onlangugage | ? | ? | 32.0 (32) | ? | ? | ? |
onstorage | ? | ? | 45.0 (45) | ? | ? | ? |
onrejectionhandled and onunhandledrejection
| ? | ? | No support | No support | No support | No support |
[1] Firefox prior to Firefox 7.0 (and some older versions of Opera) returned a URI for the HTMLBodyElement.background
attribute.
<body>
WindowEventHandlers
© 2005–2017 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