// Use different color schemes for different numbers in the root category:
// The initial order is: the URL sequence is the highest, followed by the cookie value.
// Extract the variable value from the URL string
Function getqueryvalue (sorstr, panstr)
{
VaR vstr = "";
If (sorstr = NULL | sorstr = "" | panstr = NULL | panstr = "") return vstr;
Sorstr = sorstr. tolowercase ();
Panstr + = "= ";
VaR itmp = sorstr. indexof (panstr );
If (itmp <0) {return vstr ;}
Sorstr = sorstr. substr (itmp + panstr. Length );
Itmp = sorstr. indexof ("&");
If (itmp <0)
{
Return sorstr;
}
Else
{
Sorstr = sorstr. substr (0, itmp );
Return sorstr;
}
}
Function getcookieval (offset)
{
VaR endstr = Document. Cookie. indexof (';', offset );
If (endstr =-1) endstr = Document. Cookie. length;
Return Unescape (document. Cookie. substring (offset, endstr ));
}
// Obtained from cookcie
Function getcookie (name)
{
VaR Arg = Name + '= ';
VaR Alen = Arg. length;
VaR clen = Document. Cookie. length;
VaR J = 0;
While (j <clen)
{
VaR K = J + Alen;
If (document. Cookie. substring (j, k) = Arg) return getcookieval (k );
J = Document. Cookie. indexof ('', j) + 1;
If (j = 0) break;
}
Return NULL;
}
// Obtain the URL string
VaR strgetquery = Document. Location. search;
// Obtain the csdnstyle numeric value
VaR stylevalue = getqueryvalue (strgetquery, 'csdnstyle ')
// If the URL is
If (stylevalue = '')
{
Stylevalue = getcookie ('sdnstyle ');
}
// Alert (stylevalue );
// Determine the CSS for selection
Switch (stylevalue)
{
Case '1 ':
Document. Write ('<LINK rel = "stylesheet" type = "text/CSS" href = "/expert/style/1.css"> ');
Break;
Case '2 ':
Document. Write ('<LINK rel = "stylesheet" type = "text/CSS" href = "/expert/style/2.css"> ');
Break;
Case '3 ':
Document. Write ('<LINK rel = "stylesheet" type = "text/CSS" href = "/expert/style/3.css"> ');
Break;
Case '4 ':
Document. Write ('<LINK rel = "stylesheet" type = "text/CSS" href = "/expert/style/4.css"> ');
Break;
Default:
Document. Write ('<LINK rel = "stylesheet" type = "text/CSS" href = "/expert/style/0.css"> ');
}