getElementsByTagName("ul").childNodes;
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>无标题文档</title>
</head>
<body>
<ul><li>javascript</li><li>jQuery</li><li>PHP</li></ul>
<script type="text/javascript">
var x=document.getElementsByTagName("ul")[0].childNodes;
document.write(x.length+" ");
</script>
</body>
</html>
如果没有[0],var x=document.getElementsByTagName("ul").childNodes;则无结果,必须要 var x=document.getElementsByTagName("ul")[0].childNodes;才有结果,为什么?不写[0]不就代表获取所有节点吗?