我们的志愿者还没有将这篇文章翻译为 中文 (简体)加入我们帮助完成翻译
您也可以阅读此文章的English (US)版。

The HTMLTableElement.tBodies read-only property returns a live HTMLCollection of the bodies in a <table>.

Although the property is read-only, the returned object is live and allows the modification of its content.

The collection returned includes implicit <tbody> elements. For example:

<table>
  <tr>
    <td>cell one</td>
  </tr>
</table>

The HTML DOM generated from the above HTML will have a <tbody> element even though the tags are not included in the source HTML.

Syntax

HTMLCollectionObject = table.tBodies

Example

This snippet gets the number of bodies in a table.

length(mytable.tBodies);

Specifications

Specification Status Comment
Document Object Model (DOM) Level 2 HTML Specification
The definition of 'tBodies' in that specification.
Obsolete Returns a collection of the table bodies (including implicit ones)
Document Object Model (DOM) Level 2 HTML Specification
The definition of 'Interface HTMLCollection' in that specification.
Obsolete An HTMLCollection is a list of nodes. An individual node may be accessed by either ordinal index or the node's name or id attributes.

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
tBodiesChrome Full support YesEdge Full support 12Firefox Full support YesIE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android ? Edge Mobile Full support YesFirefox Android Full support YesOpera Android Full support YesSafari iOS Full support YesSamsung Internet Android ?

Legend

Full support  
Full support
Compatibility unknown  
Compatibility unknown

See also

文档标签和贡献者

最后编辑者: mdnwebdocs-bot,