javascript里childNodes和children的区别
<html>
<head>
<script>
function init() {
for (var j = 0; j <= document.getElementById("dots").children.length; j++) {
alert(document.getElementById("dots").childNodes[j].innerHTML);
alert(document.getElementById("dots").children[j].innerHTML);
}
}
</script>
</head>
<body onload="init()">
<div id="dots" style="width: 500px; height: 20px;"><span id="a">first</span><span id="b">second</span><span id="c">third</span><span id="d">forth</span><span id="e">fifth</span><div></div></div>
</body>
</html>
http://www.mbzhan.com/biancheng/JavaScript/11073.html