HTMLBodyElement

HTMLBodyElement interface provides special properties (beyond those inherited from the regular HTMLElement interface) 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
Is an EventHandler representing the code to be called when the afterprint event is raised.
WindowEventHandlers.onbeforeprint
Is an EventHandler representing the code to be called when the beforeprint event is raised.
WindowEventHandlers.onbeforeunload
Is an EventHandler representing the code to be called when the beforeunload event is raised.
WindowEventHandlers.onhashchange
Is an EventHandler representing the code to be called when the hashchange event is raised.
WindowEventHandlers.onlanguagechange
Is an EventHandler representing the code to be called when the languagechange event is raised.
WindowEventHandlers.onmessage
Is an EventHandler called whenever an object receives a message 事件。
WindowEventHandlers.onmessageerror
Is an eventHandler called whenever an object receives a messageerror 事件。
WindowEventHandlers.onoffline
Is an EventHandler representing the code to be called when the offline event is raised.
WindowEventHandlers.ononline
Is an EventHandler representing the code to be called when the online event is raised.
WindowEventHandlers.onpagehide
Is an EventHandler representing the code to be called when the pagehide event is raised.
WindowEventHandlers.onpageshow
Is an EventHandler representing the code to be called when the pageshow event is raised.
WindowEventHandlers.onpopstate
Is an EventHandler representing the code to be called when the popstate event is raised.
WindowEventHandlers.onrejectionhandled
An EventHandler 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 EventHandler representing the code to be called when the resize event is raised.
WindowEventHandlers.onstorage
Is an EventHandler representing the code to be called when the storage event is raised.
WindowEventHandlers.onunhandledrejection
An 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
Is an EventHandler representing the code to be called when the unload event is raised.

规范

规范 状态 Comment
HTML Living Standard
The definition of 'HTMLBodyElement' in that specification.
实时标准 Technically, the event-related properties onafterprint , onbeforeprint , onbeforeunload , onblur , onerror , onfocus , onhashchange , onlanguagechange , onload , onmessage , onoffline , ononline , onpopstate , onresize , onstorage ,和 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 ,和 vLink .
The following properties have been added: onafterprint , onbeforeprint , onbeforeunload , onblur , onerror , onfocus , onhashchange , onload , onmessage , onoffline , ononline , onpopstate , onresize , onstorage ,和 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 初始定义。

浏览器兼容性

更新 GitHub 上的兼容性数据
Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
HTMLBodyElement Chrome 1 Edge 12 Firefox 1 IE 4 Opera Yes Safari Yes WebView Android Yes Chrome Android Yes Firefox Android 4 Opera Android Yes Safari iOS Yes Samsung Internet Android Yes
aLink
弃用
Chrome 1 Edge 12 Firefox 1 IE 4 Opera Yes Safari Yes WebView Android Yes Chrome Android Yes Firefox Android 4 Opera Android Yes Safari iOS Yes Samsung Internet Android Yes
background
弃用
Chrome 1 Edge 12 Firefox 1 IE 4 Opera Yes Safari Yes WebView Android Yes Chrome Android Yes Firefox Android 4 Opera Android Yes Safari iOS Yes Samsung Internet Android Yes
bgColor
弃用
Chrome 1 Edge 12 Firefox 1 IE 4 Opera Yes Safari Yes WebView Android Yes Chrome Android Yes Firefox Android 4 Opera Android Yes Safari iOS Yes Samsung Internet Android Yes
link
弃用
Chrome 1 Edge 12 Firefox 1 IE 4 Opera Yes Safari Yes WebView Android Yes Chrome Android Yes Firefox Android 4 Opera Android Yes Safari iOS Yes Samsung Internet Android Yes
text
弃用
Chrome 1 Edge 12 Firefox 1 IE 4 Opera Yes Safari Yes WebView Android Yes Chrome Android Yes Firefox Android 4 Opera Android Yes Safari iOS Yes Samsung Internet Android Yes
vLink
弃用
Chrome 1 Edge 12 Firefox 1 IE 4 Opera Yes Safari Yes WebView Android Yes Chrome Android Yes Firefox Android 4 Opera Android Yes Safari iOS Yes Samsung Internet Android Yes

图例

完整支持
完整支持
弃用。不要用于新网站。
弃用。不要用于新网站。

另请参阅

  1. HTMLBodyElement
  2. 特性
    1. onafterprint
    2. onbeforeprint
    3. onbeforeunload
    4. onhashchange
    5. onlanguagechange
    6. onmessage
    7. onmessageerror
    8. onpopstate
    9. onrejectionhandled
    10. onstorage
    11. onunhandledrejection
    12. onunload
  3. 继承:
    1. HTMLElement
    2. Element
    3. Node
    4. EventTarget
  4. Related pages for HTML DOM
    1. BeforeUnloadEvent
    2. DOMStringMap
    3. ErrorEvent
    4. GlobalEventHandlers
    5. HTMLAnchorElement
    6. HTMLAreaElement
    7. HTMLAudioElement
    8. HTMLBRElement
    9. HTMLBaseElement
    10. HTMLBaseFontElement
    11. HTMLButtonElement
    12. HTMLCanvasElement
    13. HTMLContentElement
    14. HTMLDListElement
    15. HTMLDataElement
    16. HTMLDataListElement
    17. HTMLDialogElement
    18. HTMLDivElement
    19. HTMLDocument
    20. HTMLElement
    21. HTMLEmbedElement
    22. HTMLFieldSetElement
    23. HTMLFormControlsCollection
    24. HTMLFormElement
    25. HTMLFrameSetElement
    26. HTMLHRElement
    27. HTMLHeadElement
    28. HTMLHeadingElement
    29. HTMLHtmlElement
    30. HTMLIFrameElement
    31. HTMLImageElement
    32. HTMLInputElement
    33. HTMLIsIndexElement
    34. HTMLKeygenElement
    35. HTMLLIElement
    36. HTMLLabelElement
    37. HTMLLegendElement
    38. HTMLLinkElement
    39. HTMLMapElement
    40. HTMLMediaElement
    41. HTMLMetaElement
    42. HTMLMeterElement
    43. HTMLModElement
    44. HTMLOListElement
    45. HTMLObjectElement
    46. HTMLOptGroupElement
    47. HTMLOptionElement
    48. HTMLOptionsCollection
    49. HTMLOutputElement
    50. HTMLParagraphElement
    51. HTMLParamElement
    52. HTMLPictureElement
    53. HTMLPreElement
    54. HTMLProgressElement
    55. HTMLQuoteElement
    56. HTMLScriptElement
    57. HTMLSelectElement
    58. HTMLShadowElement
    59. HTMLSourceElement
    60. HTMLSpanElement
    61. HTMLStyleElement
    62. HTMLTableCaptionElement
    63. HTMLTableCellElement
    64. HTMLTableColElement
    65. HTMLTableDataCellElement
    66. HTMLTableElement
    67. HTMLTableHeaderCellElement
    68. HTMLTableRowElement
    69. HTMLTableSectionElement
    70. HTMLTemplateElement
    71. HTMLTextAreaElement
    72. HTMLTimeElement
    73. HTMLTitleElement
    74. HTMLTrackElement
    75. HTMLUListElement
    76. HTMLUnknownElement
    77. HTMLVideoElement
    78. HashChangeEvent
    79. History
    80. ImageData
    81. Location
    82. MessageChannel
    83. MessageEvent
    84. MessagePort
    85. Navigator
    86. NavigatorGeolocation
    87. NavigatorID
    88. NavigatorLanguage
    89. NavigatorOnLine
    90. NavigatorPlugins
    91. PageTransitionEvent
    92. Plugin
    93. PluginArray
    94. PopStateEvent
    95. PortCollection
    96. PromiseRejectionEvent
    97. RadioNodeList
    98. Transferable
    99. ValidityState
    100. Window
    101. WindowBase64
    102. WindowEventHandlers
    103. WindowTimers