css|xhtml| Static | Page bled = FALSE;
}
}
}
function Getactivestylesheet () {
var i, A;
for (i=0; (A = document.getElementsByTagName ("link") [i]); i++) {
if (A.getattribute ("rel"). IndexOf ("style")!=-1 && a.getattribute ("title") &&!a.disabled) return A.getattribute ("title");
}
return null;
}
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;
}
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=/";
}
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;
}
Window.onload = function (e) {
var cookie = Readcookie ("style");
var title = cookie? Cookie:getpreferredstylesheet ();
Setactivestylesheet (title);
}
Window.onunload = function (e) {
var title = Getactivestylesheet ();
Createcookie ("style", title, 365);
}
var cookie = Readcookie ("style");
var title = cookie? Cookie:getpreferredstylesheet ();
Setactivestylesheet (title);
2, CSS calls:
CODE:
<link rel= "stylesheet" type= "Text/css" href= "default.css"/>//Default style this call
<link rel= "stylesheet" type= "Text/css" href= "One.css" title= "Name_one"/>//other styles such calls
<link rel= "stylesheet" type= "Text/css" href= "Two.css" title= "Name_two"/>
...
3, JS call:
CODE:
<script type= "Text/javascript" src= "Styleswitcher.js" ></script>
4, the realization of the choice of style:
Written in the body of the page
CODE:
<a href= "#"
> Default Style </a>
<a href= "#"
> Style one </a>
<a href= "#"
> Style two </a>