为了账号安全,请及时绑定邮箱和手机立即绑定

为什么打印不出来节点的信息?

为什么打印不出来节点信息呢?

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 />");


正在回答

3 回答

把你第一行最后的childNodes去掉

0 回复 有任何疑惑可以回复我~
#1

慕粉3688263 提问者

非常感谢!
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 />");

这样应该就可以了。

0 回复 有任何疑惑可以回复我~
#1

慕粉3688263 提问者

哦哦,很感谢!
2016-08-13 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

为什么打印不出来节点的信息?

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信