源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

js动态修改整个页面样式达到换肤效果

  • 时间:2020-06-21 11:50 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:js动态修改整个页面样式达到换肤效果
jsPro1\js动态修改整个html页面样式(换肤).html
[url=css/blue.css]<script type="text/javascript"> function gel(id) { return document.getElementById(id); } window.onload = function() { //更换css文件 var lis = gel("uList").childNodes; for (var i = 0; i < lis.length; i++) { if (lis[i].nodeType == 1) { lis[i].onclick = function () { gel("mylink").href = "css/" + this.className + ".css"; }; } } }; </script> </head> <body> <div> <span>修改整个页面的样式</span><br/> <input type="text" id="txt"/> <input type="button" value="提交" class="btn"/> </div> <ul id="uList" style="text-decoration: none;margin-top: 100px;"> <li style="display: block;width: 30px;height: 20px;background-color: red;" class="red"></li> <li style="display: block;width: 30px;height: 20px;background-color: blue" class="blue"></li> </ul> </body> </html>
jsPro1\css\red.css jsPro1\css\blue.css
[u]复制代码[/u] 代码如下:
* { margin: 0px;padding: 0px; } body { background-color: #eeeeee; } span { color: blue; } #txt { color: #0000cd;border: 1px solid #006400; } .btn { background-color: #0000cd;border: none;color: white;width: 100px;height: 28px; }
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部