急!!!! 这里面子元素节点不应该有4个吗?两个li和两个文本节点,为什么用for遍历只显示2个li
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>无标题文档</title>
</head>
<body>
<ul id="test"><li>JavaScript</li><li>HTML</li></ul>
<script type="text/javascript">
/*var otest = document.getElementById("test");
var newnode=document.createElement("li");
newnode.innerHTML="php";
otest.insertBefore(newnode,otest.childNodes[1]);
*/
var otest = document.getElementById("test");
var a=otest.childNodes;
document.write(a.length+"<br/>");
for(i=0;i<a.length;i++){
document.write(a[i].nodeName+"<br/>");
}
</script>
</body>
</html>