我如何获得当前使用JavaScript表的rowindex? [英] How do i get current rowindex of table using javascript?
本文介绍了我如何获得当前使用JavaScript表的rowindex?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
解决方案
rowIndex属性返回表中行的位置
function myFunction(x){console .log(Row index is:+ x.rowIndex);}
<表> < tr onclick =myFunction(this)> < td>点击以显示rowIndex< / td> < / TR> < tr onclick =myFunction(this)> < td>点击以显示rowIndex< / td> < / TR> < tr onclick =myFunction(this)> < td>点击以显示rowIndex< / td> < / TR> < tr onclick =myFunction(this)> < td>点击以显示rowIndex< / td> < / table>
Hello today I have one question. Can I get current row index of table in javascript ? and can we remove row of table with current Index that we got?
解决方案
The rowIndex property returns the position of a row in table
function myFunction(x) {
console.log("Row index is: " + x.rowIndex);
}
<table>
<tr onclick="myFunction(this)">
<td>Click to show rowIndex</td>
</tr>
<tr onclick="myFunction(this)">
<td>Click to show rowIndex</td>
</tr>
<tr onclick="myFunction(this)">
<td>Click to show rowIndex</td>
</tr>
<tr onclick="myFunction(this)">
<td>Click to show rowIndex</td>
</tr>
</table>
这篇关于我如何获得当前使用JavaScript表的rowindex?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文