CSS skin Replacement Technology

Source: Internet
Author: User




skin Replacement Technology

Function getcookie (name ){
VaR search = Name + "= ";
VaR returnvalue = "";
If (document. Cookie. length> 0 ){
Offset = Document. Cookie. indexof (Search );
If (offset! =-1 ){
Offset + = search. length;
End = Document. Cookie. indexof (";", offset );
If (END =-1)
End = Document. Cookie. length;
Returnvalue = Unescape (document. Cookie. substring (offset, end ));
}
}
Return returnvalue;
}

VaR thisskin;
Thisskin = getcookie ("nowskin ");
If (thisskin! = "")
Skin. href = thisskin;
Else
Skin. href = "css.css ";

Function changecss (URL ){
If (URL! = ""){
Skin. href = URL;
VaR expdate = new date ();
Expdate. settime (expdate. gettime () + (24*60*60*1000*30 ));
// Expdate = NULL;
// Set the cookie time to one year ..
Setcookie ("nowskin", URL, expdate, "/", null, false );
}
}
// -->
</SCRIPT>
</Head>
<Body>

<P> select the drop-down menu below to test the skin replacement effect. </P>

<A href = # onclick = "changecss('css.css ')"> css.css </a>
<A href = # onclick = "changecss('css1.css ')"> css1.css </a>
<A href = # onclick = "changecss('css2.css ')"> css2.css </a>
<A href = # onclick = "changecss('css3.css ')"> css3.css </a>
<Br>

<Select onchange = "changecss (this. Value)">
<Option> select a style sheet file </option>
<Script language = "JavaScript">
VaR CSSS = new array ();
CSSS [0] = "css.css ";
CSSS [1] = "css1.css ";
CSSS [2] = "css2.css ";
CSSS [3] = "css3.css ";
VaR I;
For (I = 0; I <4; I ++)
If (thisskin = CSSS [I])
Document. write ("<option value =/" "+ CSSS [I] +"/"selected>" + CSSS [I] + "style sheet file </option> ");
Else
Document. Write ("<option value =/" "+ CSSS [I] +"/">" + CSSS [I] + "style sheet file </option> ");
</SCRIPT>
</SELECT>
</Body>
</Html>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.