為什么打印不出來節點的信息?
為什么打印不出來節點信息呢?
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 />");
這樣應該就可以了。