Latest web development tutorials

Properti rowIndex HTML DOM tr

tr Referensi Obyek benda tr

Definisi dan Penggunaan

properti rowIndex mengembalikan baris ( baris ) posisi (indeks baris) dalam baris dalam tabel set.

tatabahasa

Kembali rowIndex sifat:

trObject.rowIndex

Tip: properti rowIndextidak memiliki nilai default.


Dukungan Browser

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Semua browser utama mendukung properti rowIndex


contoh

contoh

Contoh berikut mengembalikan posisi baris dalam tabel:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<script>
function displayResult(x){
    alert("Row index is: " + x.rowIndex);
}
</script>
</head>
<body>

<table border="1">
    <tr onclick="displayResult(this)">
        <td>单击显示行下标</td>
    </tr>
    <tr onclick="displayResult(this)">
    <td>单击显示行下标</td>
    </tr>
    <tr onclick="displayResult(this)">
    <td>单击显示行下标</td>
    </tr>
</table>

</body>
</html>

Coba »


tr Referensi Obyek benda tr