Jquery 控制样式表

728x15 ad here

出自Guoshuang Wiki

跳转到: 导航, 搜索

link 方式

$(document).ready(function() {
        $('.styleswitch').click(function()
        {
                switchStylestyle(this.getAttribute("rel"));
                return false;
        });
        var c = readCookie('style');
        if (c) switchStylestyle(c);
});

function switchStylestyle(styleName)
{
        $('link[@rel*=style][@title]').each(function(i)
        {
                this.disabled = true;
                if (this.getAttribute('title') == styleName) this.disabled = false;
        });
        createCookie('style', styleName, 365);
}

style import 方式

javascript:alert($("style[@media='screen']").text("body {color:red}"))
个人工具
125x125 ad here
Advertisement
120x600 ad here