HTML DOM td / th cellIndex property
Definition and Usage
cellIndex property returns the cell line collection position of the cell.
grammar
Back cellIndex properties:
tdObject.cellIndex
或者
thObject.cellIndex
或者
thObject.cellIndex
Tip: cellIndex property has no default value.
Browser Support
All major browsers support cellIndex property
Examples
Examples
Pop-up position of the cell (cellIndex):
<! DOCTYPE html>
<Html>
<Head>
<Meta charset = "utf-8">
<Title> This tutorial (w3big.com) </ title>
<Script>
function displayResult (x) {
alert ( "Cell index is:" + x.cellIndex);
}
</ Script>
</ Head>
<Body>
<Table border = "1">
<Tr>
<Td onclick = "displayResult (this)"> Click the Show Cell subscript </ td>
<Td onclick = "displayResult (this)"> Click the Show Cell subscript </ td>
</ Tr>
</ Table>
</ Body>
</ Html>
<Html>
<Head>
<Meta charset = "utf-8">
<Title> This tutorial (w3big.com) </ title>
<Script>
function displayResult (x) {
alert ( "Cell index is:" + x.cellIndex);
}
</ Script>
</ Head>
<Body>
<Table border = "1">
<Tr>
<Td onclick = "displayResult (this)"> Click the Show Cell subscript </ td>
<Td onclick = "displayResult (this)"> Click the Show Cell subscript </ td>
</ Tr>
</ Table>
</ Body>
</ Html>
try it"
td / th objects