dom - Query table cell contents from Javascript -
i'm having trouble using variable in following code snippet , wondered if correct mistake ...
function displayresult(x) { var myrowindex=x.rowindex; var mycell=document.getelementbyid('msgtable').rows[myrowindex].cells[0].childnodes[0].data; alert("cell content: " + mycell); }
myrowindex being correctly populated, when used in definition of mycell error:
document.getelementbyid("msgtable").rows undefined
my overall intention dynamically building table , users have option select row table. on selection more detail provided in separate box. table sortable first determine relevant rowindex , retrieve dataindex (which in cell[0]).
i seems work fine using test edit on w3schools site, in own code seem destroying rows object!
thanks, pete
Comments
Post a Comment