--- title: HTMLBodyElement slug: Web/API/HTMLBodyElement translation_of: Web/API/HTMLBodyElement ---
HTMLBodyElement
接口提供了特殊的属性(除了它们继承的常规的{{ domxref("HTMLElement") }}接口)以外,还可以处理 body 元素。{{InheritanceDiagram(600, 120)}}
从其父项{{domxref("HTMLElement")}} 和{{domxref("WindowEventHandlers")}}中继承属性。
No specific methods; inherits methods from its parent, {{domxref("HTMLElement")}} and from {{domxref("WindowEventHandlers")}}.
No specific event handlers; inherits event handlers from its parent, {{domxref("HTMLElement")}} and from {{domxref("WindowEventHandlers")}}.
Specification | Status | Comment |
---|---|---|
{{SpecName('HTML WHATWG', "sections.html#the-body-element", "HTMLBodyElement")}} | {{Spec2('HTML WHATWG')}} | 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 {{domxref("WindowEventHandlers")}}. HTMLBodyElement implements this interface. |
{{SpecName('HTML5.1', "sections.html#the-body-element", "HTMLBodyElement")}} | {{Spec2('HTML5.1')}} | |
{{SpecName('HTML5 W3C', "sections.html#the-body-element", "HTMLBodyElement")}} | {{Spec2('HTML5 W3C')}} | 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 . |
{{SpecName('DOM2 HTML', 'html.html#ID-62018039', 'HTMLBodyElement')}} | {{Spec2('DOM2 HTML')}} | No change from {{SpecName("DOM1")}}. |
{{SpecName('DOM1', 'level-one-html.html#ID-62018039', 'HTMLBodyElement')}} | {{Spec2('DOM1')}} | Initial definition. |