编辑下面的代码:【加编码】
<html> <body> <h1 style="color:red">Hello World</h1> <p id="demo">Click the button below to remove the style attribute from the header above.</p> <button onclick="myFunction()">Try it</button> <script> function myFunction() { document.getElementsByTagName("H1")[0].removeAttribute("style"); }; </script> </body> </html>
结果: 【此窗口】 帮助?
Try it Yourself - © 自强学堂