获取Table当前单元格的值
<script language=javascript>
window.onload = function calcRowIndex(row)
{
var obj = document.getElementById("tbl");
if(obj)
{
// alert(obj.rows[0].cells.length);
var tds = obj.getElementsByTagName("td");
if(tds)
{
for(i=0;i<tds.length;i++)
{
tds[i].onclick = AlertValue;
}
}
}
}
function AlertValue(){
alert(this.innerText);
}
</script>
<table id="MyTable" border="1">
<tbody>
<tr><td>行1列1</td><td>行1列2</td><td>行1列3</td></tr>
<tr><td>行2列1</td><td>行2列2</td><td>行2列3</td></tr>
<tr><td>行3列1</td><td>行3列2</td><td>行3列3</td></tr>
</tbody>
</table>