HTMLBodyElement

HTMLBodyElement 接口提供了特殊的属性(除了它们继承的常规的HTMLElement接口)以外,还可以处理 body 元素。

属性

从其父项HTMLElement 中继承属性。

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.

Is a DOMString that represents the color of unvisited links.

HTMLBodyElement.text 已弃用

Is a DOMString that represents the foreground color of text.

Is a DOMString that represents the color of visited links.

方法

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

事件处理

No specific event handlers; inherits event handlers from its parent, HTMLElement.

HTMLBodyElement.onafterprint

Is an event handler representing the code to be called when the afterprint (en-US) event is raised.

HTMLBodyElement.onbeforeprint

Is an event handler representing the code to be called when the beforeprint (en-US) event is raised.

HTMLBodyElement.onbeforeunload

Is an event handler representing the code to be called when the beforeunload (en-US) event is raised.

HTMLBodyElement.onhashchange

Is an event handler representing the code to be called when the hashchange (en-US) event is raised.

HTMLBodyElement.onlanguagechange 实验性

Is an event handler representing the code to be called when the languagechange (en-US) event is raised.

HTMLBodyElement.onmessage

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

HTMLBodyElement.onmessageerror

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

HTMLBodyElement.onoffline

Is an event handler representing the code to be called when the offline (en-US) event is raised.

HTMLBodyElement.ononline

Is an event handler representing the code to be called when the online (en-US) event is raised.

HTMLBodyElement.onpagehide

Is an event handler representing the code to be called when the pagehide (en-US) event is raised.

HTMLBodyElement.onpageshow

Is an event handler representing the code to be called when the pageshow (en-US) event is raised.

HTMLBodyElement.onpopstate

Is an event handler representing the code to be called when the popstate (en-US) event is raised.

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

HTMLBodyElement.onstorage

Is an event handler representing the code to be called when the storage (en-US) event is raised.

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

HTMLBodyElement.onunload

Is an event handler representing the code to be called when the unload (en-US) event is raised.

规范

Specification
HTML Standard
# htmlbodyelement

浏览器兼容性

BCD tables only load in the browser

参考阅读

  • HTML element implementing this interface: <body>