Introduce
Just set a id to the "link" element like
<link type="text/css" rel="stylesheet" rev="stylesheet" href="css/null.css" media="all" id="changecss"/>
OK,let's go!<a href="javascript:document.getElementById('changecss').href='css/blue.css';void(0);">get blue</a>
click here to get blue In jQuery ,I do it like this:
jQuery(function() {
$("#changecss").attr("href","css/"+$.cookie("style")+".css"); //get cookie
$("#sidebar>ul>li>a").click(function() {
$("#changecss").attr("href","css/"+$.trim($(this).text())+".css"); //set set href attribute of link
$.cookie("style",$.trim($(this).text()),{ expires: 365}) //set cookie
return false;
})
});