I seem to be getting different results of fromDate between Mozilla and IE.
Is there a more reliable cross-browser way of doing this? [edit] I am actually getting different column values! [/edit]
<tr id='id3332201010241' />
<td>20101024</td>
<td>20101025</td>
<td>1415</td>
<td>1445</td>
<td>INVDROP</td>
<td>H4T1A3</td>
<td><a href='#' onclick='selectEditActivity("id3332201010241");' >Click Here</a></td>
</tr>
function selectEditActivity(pass_id){
row = document.getElementById(pass_id);
var seq = document.getElementById(pass_id).getAttribute("seq");
var from_date = row.childNodes[1].innerHTML;
alert(from_date);
var to_date = row.childNodes[3].innerHTML;
}
You are seeing the result of differences in how different browsers handle white-space. Instead (for more general cases) you can use
getElementsByTagName()to for sure get a certain type of child element (<td>in this case), like this:You can test it out here. As @patrick points out though, it’s not needed here, just use the
.cellsof the<tr>, like this:You can test it out here.