35 lines
1.0 KiB
JavaScript
35 lines
1.0 KiB
JavaScript
// *** Cookies ***
|
|
function writeCookie(name, value) {
|
|
exp = new Date();
|
|
exp.setTime(exp.getTime() + (86400 * 1000 * 30));
|
|
document.cookie = name + "=" + escape(value) + "; expires=" + exp.toGMTString() + "; path=/";
|
|
document.cookie.replace("stylesheet=css0","stylesheet="+value);
|
|
}
|
|
function readCookie(name) {
|
|
var search;
|
|
search = name + "=";
|
|
offset = document.cookie.indexOf(search);
|
|
if (offset != -1) {
|
|
offset += search.length;
|
|
end = document.cookie.indexOf(";", offset);
|
|
if (end == -1){
|
|
end = document.cookie.length;
|
|
}
|
|
return unescape(document.cookie.substring(offset, end));
|
|
}else{
|
|
return "";
|
|
}
|
|
}
|
|
|
|
function setStyleSheet(strCSS){
|
|
var objs=document.getElementsByTagName("link");
|
|
var intFound=0;
|
|
for(var i=0;i<objs.length;i++){
|
|
if(objs[i].type.indexOf("css")>-1&&objs[i].title){
|
|
objs[i].disabled = true;
|
|
if(objs[i].title==strCSS) intFound=i;
|
|
}
|
|
}
|
|
objs[intFound].disabled = false;
|
|
writeCookie("stylesheet",objs[intFound].title);
|
|
} |