代码示例:(标识:jsck_document_queryselector_multiple_1)
<!DOCTYPE html>
<html>
<body>

<h1>Document 对象</h1>

<h2>querySelector() 方法</h2>

<p>选择第一个 h3 或第一个 h4:</p>
<h3>h3 元素</h3>
<h4>h4 元素</h4>

<script>
document.querySelector("h3, h4").style.backgroundColor = "red";
</script>

</body>
</html>
运行结果: