首先准备好几种风格的css文件:
样式部分:
<link id="css" rel="stylesheet" type="text/css" href="style.css"/>
js部分
function redCSS(){
document.getElementById("css").href="red.css";
}
html部分
<span onclick="redCSS">切换红色风格</span>
如果需要下次打开页面抱持这个风格,那么需要用到cookie
温馨提示:答案为网友推荐,仅供参考