querySelector 只能返回遇到的第一个对象
querySelectorAll 返回所有的
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>获取常规元素</title>
</head>
<body>
<ul>
<li class="newsitem">111111111</li>
<li class="newsitem">111111111</li>
<li class="newsitem">111111111</li>
</ul>
<ul>
<li class="adsitem">111111111</li>
<li class="adsitem">111111111</li>
<li class="adsitem">111111111</li>
</ul>
<script>
// querySelector 只能返回遇到的第一个对象
var item = document.querySelector("ul li")
console.log(item)
// querySelectorAll 返回所有的
var item1 = document.querySelectorAll("ul li.newsitem")
console.log(item1)
</script>
</body>
</html>