HTMLBodyElement
属性
从其父项HTMLElement 中继承属性。
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.
方法
No specific methods; inherits methods from its parent, HTMLElement.
事件处理器
继承了 HTMLElement 的事件。
以下以 Window 为目标的 onXYZ 事件处理器属性同样在 window 对象这一别名目标上可用。但建议直接在 window 对象上监听这些事件,而不是在 HTMLBodyElement 上。
备注: 对于以下的 onXYZ 事件处理器,在 HTMLBodyElement 上使用 addEventListener() 将不会生效。请在 window 对象上监听这些事件。
HTMLBodyElement.onafterprint-
Fired after the associated document has started printing or the print preview has been closed.
HTMLBodyElement.onbeforeprint-
Fired when the associated document is about to be printed or previewed for printing.
HTMLBodyElement.onbeforeunload-
Fired when the window, the document and its resources are about to be unloaded.
HTMLBodyElement.ongamepadconnected-
Fired when the browser detects that a gamepad has been connected or the first time a button/axis of the gamepad is used.
HTMLBodyElement.ongamepaddisconnected-
Fired when the browser detects that a gamepad has been disconnected.
HTMLBodyElement.onhashchange-
Fired when the fragment identifier of the URL has changed (the part of the URL beginning with and following the
#symbol). HTMLBodyElement.onlanguagechange-
Fired when the user's preferred language changes.
HTMLBodyElement.onmessage-
Fired when the window receives a message, for example from a call to
Window.postMessage()from another browsing context. HTMLBodyElement.onmessageerror-
Fired when the window receives a message that can't be deserialized.
HTMLBodyElement.onoffline-
Fired when the browser has lost access to the network and the value of
Navigator.onLine(en-US) switches tofalse. HTMLBodyElement.ononline-
Fired when the browser has gained access to the network and the value of
Navigator.onLine(en-US) switches totrue. HTMLBodyElement.onpagehide-
Fired when the browser hides the current page in the process of presenting a different page from the session's history.
HTMLBodyElement.onpageshow-
Fired when the browser displays the window's document due to navigation.
HTMLBodyElement.onpopstate-
Fired when the active history entry changes while the user navigates the session history.
HTMLBodyElement.onrejectionhandled-
Fired whenever a JavaScript
Promiseis rejected and the rejection has been handled. HTMLBodyElement.onstorage-
Fired when a storage area (
localStorage) has been modified in the context of another document. HTMLBodyElement.onunhandledrejection-
Fired whenever a
Promiseis rejected but the rejection was not handled. HTMLBodyElement.onunload-
Fired when the document is being unloaded.
规范
| Specification |
|---|
| HTML Standard # htmlbodyelement |
浏览器兼容性
BCD tables only load in the browser
参见
- HTML 元素实现了这个接口:
<body>