<table> | |
<th id="h1">Header 1</td> | |
<td id="c1">Cell 1</td> | |
<script></script> | |
<td id="c2">Cell 2</td> | |
</table> | |
<script> | |
function outputIndex(name) { | |
node = document.getElementById(name); | |
document.writeln(name + " has index " + node.cellIndex + "<br>"); | |
} | |
outputIndex("h1"); | |
outputIndex("c1"); | |
outputIndex("c2"); | |
</script> |