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 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.

HTMLBodyElement.link

Is a DOMString that represents the color of unvisited links.

HTMLBodyElement.text

Is a DOMString that represents the foreground color of text.

HTMLBodyElement.vLink

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.onmessage

Is an event handler called whenever an object receives a message event.

WindowEventHandlers.onmessageerror

Is an event handler called whenever an object receives a messageerror event.

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

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
HTMLBodyElement
1
12
1
4
≤12.1
3
1
18
4
≤12.1
1
1.0
aLink
1
12
1
4
≤12.1
3
1
18
4
≤12.1
1
1.0
background
1
12
1
4
≤12.1
3
1
18
4
≤12.1
1
1.0
bgColor
1
12
1
4
≤12.1
3
1
18
4
≤12.1
1
1.0
link
1
12
1
4
≤12.1
3
1
18
4
≤12.1
1
1.0
onorientationchange
No
No
No
No
No
No
Yes
Yes
No
Yes
Yes
Yes
text
1
12
1
4
≤12.1
3
1
18
4
≤12.1
1
1.0
vLink
1
12
1
4
≤12.1
3
1
18
4
≤12.1
1
1.0

See also

© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/HTMLBodyElement