--- title: HTMLTableRowElement.rowIndex slug: Web/API/HTMLTableRowElement/rowIndex tags: - rowIndex - table - tr translation_of: Web/API/HTMLTableRowElement/rowIndex --- <h2 id="Summary" name="Summary">概要</h2> <p>このプロパティは、テーブル全体に関連して <a href="/ja/docs/DOM/HTMLTableRowElement" title="DOM/HTMLTableRowElement">行 (row)</a> の 位置 (index) を {{htmlelement("thead")}} 、{{htmlelement("tbody")}} 、{{htmlelement("tfoot")}} の順序で取得します。</p> <p>※Opera は前述の順序ではなく、 HTML 中の記述順で rowIndex を取得します。</p> <h2 id="Example" name="Example">例</h2> <pre class="brush: html"><table> <thead> <tr> <th>品目</th> <th>価格</th> </tr> </thead> <tbody> <tr> <td>抹茶プリン</td> <td>250 円</td> </tr> <tr> <td>カスタードプリン</td> <td>200 円</td> </tr> <tr> <td>牛乳プリン</td> <td>150 円</td> </tr> </tbody> <tfoot> <tr> <td>小計</td> <td>600 円</td> </tr> </tfoot> </table></pre> <p>rowIndex の値を表示する例を以下に示します。</p> <pre class="brush: javascript">var rows = document.getElementsByTagName('tr'); for(var x = 0, xLength = rows.length; x < xLength; x++) { alert('rowIndex=' + rows[x].rowIndex); }</pre> <h2 id="Compatibility" name="Compatibility">互換性</h2> <p>Quirksmode.org の <a href="http://www.quirksmode.org/dom/w3c_html.html#t317">rowIndex browser compatibility</a> を参照して下さい。</p>