简体   繁体   English

在Internet Explorer中使用子节点不起作用?

[英]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: 我的代码在Chrome上可以100%正常运行,它的工作是从表行中获取文本和值,但是一旦进入IE,它就会停止工作,我将其范围缩小到childNodes,这里是代码的快速示例在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? 有谁知道我可以在这里为IE替换childNodes吗?

.childNodes also returns Elements of type "CharakterData", for example White Space in your html code. .childNodes还会返回“ CharakterData”类型的Elements,例如html代码中的White Space。 To refer to the actual HTML-Nodes, use the method " .children " 要引用实际的HTML节点,请使用方法“ .children

See more information here 在这里查看更多信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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