TableRowrowIndexプロパティ_
例
別の行をクリックして、インデックスの位置を警告します。
alert("Row index is: " + x.rowIndex);
定義と使用法
rowIndexプロパティは、テーブルの行コレクション内の行の位置を返します。
ブラウザのサポート
Property | |||||
---|---|---|---|---|---|
rowIndex | Yes | Yes | Yes | Yes | Yes |
構文
rowIndexプロパティを返します。
tablerowObject.rowIndex
技術的な詳細
戻り値: | テーブルの行コレクション内の行の位置を表す数値。 |
---|
その他の例
例
テーブルの各行のインデックス位置を返します。
var x = document.getElementsByTagName("tr");
var txt = "";
var i;
for (i = 0; i < x.length; i++) {
txt = txt + "The index of Row "+(i+1)+" is: "+x[i].rowIndex+"<br>";
}
❮TableRowオブジェクト