aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/htmltableelement/rows/index.html
blob: af8619af5e9c2db67a1ed7b3503d67b16b1b642c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
---
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>