io di solito uso questo lato client
codice:
//Creo il cookie
function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}
//Leggo il cookie
function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}
//Setto il CSS attivo
function setActiveStyleSheet(title) {
var i, a, main;
for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
a.disabled = true;
if(a.getAttribute("title") == title) a.disabled = false;
}
}
createCookie("style", title, 365);
}
function getPreferredStyleSheet() {
var i, a;
for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
if(a.getAttribute("rel").indexOf("style") != -1
&& a.getAttribute("rel").indexOf("alt") == -1
&& a.getAttribute("title")
) return a.getAttribute("title");
}
return null;
}
//RIDIMENSIONAMENTO DEL TESTO
function setFontSize(size) {
var body = document.getElementsByTagName('body')[0];
if (size == 1) percentuale = "75%";
if (size == 2) percentuale = "100%";
if (size == 3) percentuale = "120%";
body.style.fontSize = percentuale;
createCookie('fontUtente',size,365);
}
var cookie = readCookie("style");
var title = cookie ? cookie : getPreferredStyleSheet();
setActiveStyleSheet(title);
/* size = readCookie('fontUtente');
if(size){setFontSize(size);}
else{size=2;}
createCookie('fontUtente',size,365);*/
//
basta richiamare con un link setActiveStyleSheet(title) passando il titolo del css che vuoi rendere attivo.
c'è già anche la funzione setFontSize(size) per ingrandire/ridurre la dimensione del testo. basta decommentare le ultime righe