编辑下面的代码:【加编码】
<html> <body> <div id="myDIV"> <h2> h2 元素</h2> <h3> h3 元素</h3> </div> <script> var x = document.getElementById("myDIV"); x.querySelector("h2, h3").style.backgroundColor = "red"; </script> </body> </html>
结果: 【此窗口】 帮助?
Try it Yourself - © 自强学堂