_Capricornna
2016-07-21 16:19
<script type="text/javascript"> var x=document.getElementsById("con"); for(var i in x.childNodes){ if(x.childNodes[i].nodeType!=1){ x.removeChild(x.childNodes[i]); } } document.write(x.firstChild.nodeName+","+x.firstChild.nodeValue); document.write(x.lastChid.nodeName+","+x.lastChild.nodeVale); </script>
for(var i = 0; i < x.childNodes.length; i++)
document.write(x.lastChild.nodeName+","+x.lastChild.nodeValue);
for in一般用于遍历枚举类型
document.getElementsById("con")改成document.getElementById("con")
JavaScript进阶篇
468061 学习 · 21891 问题
相似问题