运行结果尺寸: 300 x 150
x
 
<!DOCTYPE html>
<html>
<head>
<style>
#myDIV {
  border: 1px solid black;
}
</style>
</head>
<body>
<div id="myDIV">
  <h3>div 中的 h3 元素</h3>
  <h2>div 中的 h2 元素</h2>
</div>
<script>
var x = document.getElementById("myDIV");
x.querySelector("h2, h3").style.backgroundColor = "red";
</script>
</body>
</html>
×

报个问题: