简单教程
提交运行
代码编辑器:
<link id="style1" rel="stylesheet" type="text/css" href="/static/i/javascript/basic/style1.css"> <script> function displayResult(){ document.getElementById("style1").href="/static/i/javascript/basic/style2.css"; } </script> <h1>我的网站主页</h1> <button type="button" onclick="displayResult()">切换样式表</button>
运行结果: