td/th 對象
定義和用法
cellIndex 屬性可傳回一行的單元格集合中單元格的位置。
文法
傳回 cellIndex 屬性:
tdObject.cellIndex
或者
thObject.cellIndex
提示:cellIndex 屬性沒有預設值。
浏覽器支援

所有主流浏覽器都支援 cellIndex 屬性
執行個體
彈出單元格的位置(cellIndex):
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鳥教程(runoob.com)</title>
<script>
function displayResult(x){
alert("Cell index is: " + x.cellIndex);
}
</script>
</head>
<body>
<table border="1">
<tr>
<td onclick="displayResult(this)">單擊顯示單元格下标</td>
</tr>
</table>
</body>
</html>
td/th 對象