I'd like to use this code to select a particular row
我想使用此代码来选择特定的行
var table = document.getElementById("mytable");
table.rows[0].cells[3].innerHTML = 'here';
and instead of entering the row number I want to put a variable holding a number inside so I can locate a specific row. The number of rows on the table can change.
而不是输入行号我想把一个数字放在里面,所以我可以找到一个特定的行。表上的行数可以更改。
Is there any other way to do this?
有没有其他方法可以做到这一点?
1 个解决方案
#1
-1
var table = document.getElementById("mytable");
table.rows[0].cells[3].innerHTML = 'here';
<table id="mytable" border="2">
<tr>
<td>25</td>
<td>25</td>
<td>25</td>
<td>25</td>
</tr>
</table>
#1
-1
var table = document.getElementById("mytable");
table.rows[0].cells[3].innerHTML = 'here';
<table id="mytable" border="2">
<tr>
<td>25</td>
<td>25</td>
<td>25</td>
<td>25</td>
</tr>
</table>