I’m trying for 2 days to merge this 2 codes into 1 , because one works perfectly in IE, and the other one works perfectly in FF and Chrome. So how can i merge them into 1?
This is the code that is working in IE, but not in FF:
….
if (i < rowCount - 1) {
detRez += dataTable.rows[i].cells[1].firstChild.value + "^";
detRez += dataTable.rows[i].cells[2].firstChild.value + "%";
//This working with FF
//detRez += dataTable.rows[i].cells[1].childNodes[1].value + "^";
//detRez += dataTable.rows[i].cells[2].childNodes[1].value + "%";
}
else {
detRez += dataTable.rows[i].cells[1].firstChild.value + "^";
detRez += dataTable.rows[i].cells[2].firstChild.value;
//This working with FF
//detRez += dataTable.rows[i].cells[1].childNodes[1].value + "^";
//detRez += dataTable.rows[i].cells[2].childNodes[1].value;
}
}
.....
The one that works in FF but not in IE has // in front of the line
I get no error in FF (if i test the IE code), only that the string isn’t build correctly and looks like this : undefined^undefined%undefined^undefined instead of MyText^…..
Any ideas how to merge those 2 codes to work both in IE and FF? Thanks in advance.
Firefox and Internet Explorer handle child nodes differently. Firefox uses DOM compliant mode and counts gaps between tags and so forth. Internet Explorer only counts some of them (hence the inconsistencies between the two).
You should consider using
getElementsByTagName()instead ofchildNodes[].