--- title: HTMLTableElement.rows slug: Web/API/HTMLTableElement/rows tags: - HTML Table Element - HTMLTableElement.cells - HTMLTableElement.rows translation_of: Web/API/HTMLTableElement/rows --- <div> <div> <div>{{APIRef("HTML DOM")}}</div> <div>表中所有行的</div> </div> </div> <p><code><strong>HTMLTableElement.rows</strong></code> 只读属性返回表中所有行的一个活的 {{domxref("HTMLCollection")}}。<code><strong>HTMLTableElement.rows</strong></code> 包括与之相关的{{HTMLElement("thead")}}, {{HTMLElement("tfoot")}} 和 {{HTMLElement("tbody")}} 元素.</p> <p>Although the property is read-only, the returned object is live and allows the modification of its content.</p> <h2 id="Syntax" name="Syntax">Syntax</h2> <pre class="syntaxbox"><em>HTMLCollectionObject</em> = table.rows</pre> <h2 id="Example" name="Example">Example</h2> <pre class="brush:js">myrows = mytable.rows; firstRow = mytable.rows[0]; lastRow = mytable.rows[mytable.rows.length-1];</pre> <h2 id="Specification" name="Specification">Specification</h2> <ul> <li><a class="external" href="http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-6156016">rows</a></li> <li><a class="external" href="http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-75708506">HTMLcollection</a></li> </ul>