指明文檔主體的開始和結(jié)束。
Specifies the beginning and end of the document body.
在 Internet Explorer 6 中,如果你使用 !DOCTYPE 聲明指定為標(biāo)準(zhǔn)兼容模式,body 對(duì)象可以從其內(nèi)容獲取其大小,或者你可以像 div 對(duì)象那樣嚴(yán)格設(shè)置其大小。在標(biāo)準(zhǔn)兼容模式下,html 元素會(huì)代表文檔可顯示內(nèi)容的整個(gè)外觀。如果 !DOCTYPE 聲明并不指定標(biāo)準(zhǔn)兼容模式,以及較早版本的 Internet Explorer,則是 body 對(duì)象代表文檔可顯示內(nèi)容的整個(gè)外觀。body 對(duì)象的大小無(wú)法更改,它等于窗口的大小。你在此對(duì)象上設(shè)置的邊距位于此對(duì)象的邊框和滾動(dòng)條之內(nèi)。
你可以在腳本中通過(guò) document 對(duì)象來(lái)訪問(wèn) body 元素。
元素 body 的 window 對(duì)象可以處理 onblur, onfocus, onload, 或 onunload 事件。
此元素在 Internet Explorer 3.0 及以上版本的 HTML 中可用,在 Internet Explorer 4.0 及以上版本的腳本中可用。
此元素是塊元素。
此元素需要關(guān)閉標(biāo)簽。
As of Internet Explorer 6, when you use the !DOCTYPE declaration to specify standards-compliant mode, the body object can obtain its size from its content, or you can set its size explicitly—like a div object, for example. In standards-compliant mode, the html element represents the entire surface onto which a document‘s contents can be rendered. When the !DOCTYPE declaration does not specify standards-compliant mode, and with earler versions of Internet Explorer, the body object represents the entire surface onto which a document‘s contents can be rendered. The size of the body object cannot be changed and is equal to the size of the window. Margins you set on this object are rendered inside the border and scrollbars of the object.
You can access the body element from script through the document object.
The window object for the body element can host event handlers for the onblur, onfocus, onload, or onunload events.
This element is available in HTML as of Internet Explorer 3.0, and in script as of Internet Explorer 4.0.
This element is a block element.
This element requires a closing tag.
下面的例子在腳本中引用了 body 元素。
This example exposes the body element in script.
var oBody = document.body;
聯(lián)系客服