<body>
<ul>
<li>11</li>
<li>12</li>
</ul>
<ul id="second">
<li>23</li>
<li>13</li>
</ul>
<script>
//获取的时元素对象集合 以为数组的形式存储
var van = document.getElementsByTagName('li')
console.log(van)
//想打印就遍历
for (var i = 0; i < van.length; i++) {
console.log(van[i])
}
//element. 多组相同元素时可用id区分,先得到id元素
var second = document.getElementById('second')
var secondlis = second.getElementsByTagName('li')
for (var i = 0; i < secondlis.length; i++) {
console.log(secondlis[i])
}
</script>
</body>