2013-06-12 75 views
0

如何使用rowindex获取子节点的值,该值是动态创建的?获取行索引子节点的值

我试着用下面的代码,但错误出现"Unable to get the value of the property childnodeID"

var table = document.getElementById('tableID'); 
var Row = table.rows['childnodeID']; //error 
Row.cells[0].innerText = i; 
+1

'“childnodeID''不该” t是一个字符串;它应该是一个数字。 –

回答

1

childnodeID必须是number.Index永远不会成为一个string.It必须是数字

+0

'childnodeID'是动态创建的子节点的ID。 –

+0

然后找到那个孩子的索引,然后使用它 – PSR

+0

'var Row1 = table.rows [5];'有错误 - 无法获得5的值,而使用table.rows,但我用table.childNode,错误出现在下一行'Row.cells [0] .innerText = i;'因为单元格值未定义。 –