為什么打印不出來節(jié)點(diǎn)的信息?
為什么打印不出來節(jié)點(diǎn)信息呢?
var x=document.getElementById("con").childNodes;
? document.write(x.length+"<br>");
? document.write(x.firstChild.nodeName+"<br />");
? document.write(x.firstChild.nodeType+"<br />");
? document.write(x.firstChild.nodeValue+"<br />");
2016-08-13
把你第一行最后的childNodes去掉
2016-08-13
var x=document.getElementById("con");
? document.write(x.length+"<br>");
? document.write(x.firstChild.nodeName+"<br />");
? document.write(x.firstChild.nodeType+"<br />");
? document.write(x.firstChild.nodeValue+"<br />");
這樣應(yīng)該就可以了。