js获得当前的行是表格的第几行代码
[05-26 12:48:56] 来源:http://www.89xue.com 电脑常识 阅读:90次
摘要:<script>function getrow(obj){if(event.srcElement.tagName=="TD"){curRow=event.srcElement.parentElement;alert("这是第"+(curRow.rowIndex+1)+"行");}}</script><table border="1" width="100%" onclick=getrow(this)><tr><td width="20%"&g。
js获得当前的行是表格的第几行代码,标签:电脑常识范文,http://www.89xue.com
<script>
function getrow(obj)
{
if(event.srcElement.tagName=="TD"){
curRow=event.srcElement.parentElement;
alert("这是第"+(curRow.rowIndex+1)+"行");
}
}
</script>
<table border="1" width="100%" onclick=getrow(this)>
<tr>
<td width="20%"> </td>
<td width="20%"> </td>
<td width="20%"> </td>
<td width="20%"> </td>
<td width="20%"> </td>
</tr>
<tr>
<td width="20%"> </td>
<td width="20%"> </td>
<td width="20%"> </td>
<td width="20%"> </td>
<td width="20%"> </td>
</tr>
</table>//
Tag:电脑常识,电脑常识范文,生活常识 - 电脑常识
上一篇:龙岩叶脉网络——龙岩网站建设推荐