求教代碼哪里錯了
<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>
2016-07-22
? for(var i = 0; i < x.childNodes.length; i++)
document.write(x.lastChild.nodeName+","+x.lastChild.nodeValue);
2016-11-16
for in一般用于遍歷枚舉類型
2016-07-22
document.getElementsById("con")改成document.getElementById("con")