首页 > Web开发 > 详细

jquery换肤

时间:2015-08-06 12:55:36      阅读:275      评论:0      收藏:0      [点我收藏+]

<script src="script/jquery-2.1.0.js"></script>  
    <link href="style/green.css" rel="stylesheet" id="theme" />  
    <script type="text/javascript">  
        $(function () {  
            $("button").click(function () {  
                var themecss = $("#theme");  //link元素的id
                themecss.attr("href", "style/blue.css");  
                //或者  
                var themeCSS = document.getElementById(‘theme‘);  
                themeCSS.href = "style/blue.css";  
                  
            });  
        });  
    </script>

 

 

最终效果是:假设左上角有3个切换皮肤的按钮,点击不同的按钮,将切换不同的皮肤。没有设置cookie皮肤记忆,所以当刷新的时候,还是会回到默认的皮肤,大家喜欢的话可以再往精致的地方做一下。

jquery换肤

原文:http://www.cnblogs.com/koleyang/p/4707431.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!