HTML DOM 그럴 rowIndex에 등록
정의 및 사용
rowIndex에 숙박 시설은 행 (리턴 행 테이블 세트의 행) 위치 (행 인덱스).
문법
위로 특성을 rowIndex 위치 :
trObject.rowIndex
팁 : rowIndex에 속성에는 기본값이 없습니다.
브라우저 지원
모든 주요 브라우저는 rowIndex에 속성을 지원
예
예
다음의 예는 테이블의 행의 위치를 반환
<!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>
<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>
»시도
그럴 객체