编辑下面的代码:【加编码】
<html> <head> <link id="style1" rel="stylesheet" type="text/css" href="/demo/style1.css"> <script> function displayResult() { document.getElementById("style1").href="style2.css"; } </script> </head> <body> <h1>My Web Page</h1> <button type="button" onclick="displayResult()">Switch style sheet</button> </body> </html>
结果: 【此窗口】 帮助?
Try it Yourself - © 自强学堂