87,924
社区成员
发帖
与我相关
我的任务
分享
<table width="100%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td onclick="alert(this.cellIndex)"> </td>
<td onclick="alert(this.cellIndex)"> </td>
<td onclick="alert(this.cellIndex)"> </td>
<td onclick="alert(this.cellIndex)"> </td>
<td onclick="alert(this.cellIndex)"> </td>
</tr>
<tr>
<td onclick="alert(this.cellIndex)"> </td>
<td onclick="alert(this.cellIndex)"> </td>
<td onclick="alert(this.cellIndex)"> </td>
<td onclick="alert(this.cellIndex)"> </td>
<td onclick="alert(this.cellIndex)"> </td>
</tr>
<tr>
<td onclick="alert(this.cellIndex)"> </td>
<td onclick="alert(this.cellIndex)"> </td>
<td onclick="alert(this.cellIndex)"> </td>
<td onclick="alert(this.cellIndex)"> </td>
<td onclick="alert(this.cellIndex)"> </td>
</tr>
<tr>
<td onclick="alert(this.cellIndex)"> </td>
<td onclick="alert(this.cellIndex)"> </td>
<td onclick="alert(this.cellIndex)"> </td>
<td onclick="alert(this.cellIndex)"> </td>
<td onclick="alert(this.cellIndex)"> </td>
</tr>
<tr>
<td onclick="alert(this.cellIndex)"> </td>
<td onclick="alert(this.cellIndex)"> </td>
<td onclick="alert(this.cellIndex)"> </td>
<td onclick="alert(this.cellIndex)"> </td>
<td onclick="alert(this.cellIndex)"> </td>
</tr>
</table>
<script language="javascript">
function fx(v){
var target=document.getElementsByTagName("tr")
for(var i=0;i<target.length;i++)
if(v==target[i])
alert("行号:"+parseInt(i+1))
}
</script>
<table width="100%" border="1" cellspacing="0" cellpadding="0">
<tr onclick="fx(this)">
<td> </td>
</tr>
<tr onclick="fx(this)">
<td> </td>
</tr>
<tr onclick="fx(this)">
<td> </td>
</tr>
<tr onclick="fx(this)">
<td> </td>
</tr>
<tr onclick="fx(this)">
<td> </td>
</tr>
</table>