简体   繁体   中英

Using Child nodes for Internet Explorer isn't working?

My code works 100% fine on Chrome and what it does is it gets the text and value from in table rows but as soon as it goes to IE it stops working and i have narrowed it down to childNodes here is a quick sample of the code that doesn't work in IE:

var t = document.getElementById('tableFull');

for (var i = 1, row; row = t.rows[i]; i++) {

   var tee = t.childNodes[3].childNodes[i].rowIndex;
   var subtractCost =t.childNodes[3].childNodes[i].childNodes[1].childNodes[1].innerHTML;
   var subtractName = t.childNodes[3].childNodes[i].childNodes[0].childNodes[0].innerHTML;

}

Anyone know how i can replace the childNodes here for IE?

.childNodes also returns Elements of type "CharakterData", for example White Space in your html code. To refer to the actual HTML-Nodes, use the method " .children "

See more information here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM