The page has multiple CSS as a check box for users to select

Source: Internet
Author: User
Tags setcookie
Tip: you can modify some code before running

<p><HTML><br /><HEAD><br /><TITLE> new skin replacement technology </TITLE><br /><Link ID = "skin" rel = "stylesheet" type = "text/css"><br /><Script language = javascript><br /><! --<br />Function SetCookie (name, value ){<br />Var argv = SetCookie. arguments;<br />Var argc = SetCookie. arguments. length;<br />Var expires = (2 <argc )? Argv [2]: null;<br />Var path = (3 <argc )? Argv [3]: null;<br />Var domain = (4 <argc )? Argv [4]: null;<br />Var secure = (5 <argc )? Argv [5]: false;<br />Document. cookie = name + "=" + escape (value) + (expires = null )? "" :( "; Expires =" + expires. toGMTString () + (path = null )? "" :( "; Path =" + path) + (domain = null )? "" :( "; Domain =" + domain) + (secure = true )? "; Secure ":"");<br />}</p><p>Function GetCookie (Name ){<br />Var search = Name + "= ";<br />Var returnvalue = "";<br />If (document. cookie. length> 0 ){<br />Offset = document. cookie. indexOf (search );<br />If (offset! =-1 ){<br />Offset + = search. length;<br />End = document. cookie. indexOf (";", offset );<br />If (end =-1)<br />End = document. cookie. length;<br />Returnvalue = unescape (document. cookie. substring (offset, end ));<br />           }<br />     }<br />Return returnvalue;<br />}</p><p>Var thisskin;<br />Thisskin = GetCookie ("nowskin ");<br />If (thisskin! = "")<br />Skin. href = thisskin;<br />Else<br />Skin. href = "css.css ";</p><p>Function changecss (url ){<br />If (url! = ""){<br />Skin. href = url;<br />Var expdate = new Date ();<br />Expdate. setTime (expdate. getTime () + (24*60*60*1000*30 ));<br />// Expdate = null;<br />// Set the cookie time to one year ..<br />SetCookie ("nowskin", url, expdate, "/", null, false );<br />     }<br />}<br />// --><br /></SCRIPT><br /></HEAD><br /><BODY></p><p><P> select the drop-down menu below to test the skin replacement effect. </P></p><p><Select onchange = "changecss (this. value)"><br /><Option> select a style sheet file </option><br /><Script language = "javascript"><br />Var csss = new Array ();<br />Csss [0] = "001.css ";<br />Csss [1] = "002.css ";<br />Csss [2] = "003.css ";<br />Csss [3] = "004.css ";<br />Var I;<br />For (I = 0; I <4; I ++)<br />If (thisskin = csss [I])<br />Document. write ("<option value = \" "+ csss [I] +" \ "selected>" + csss [I] + "style sheet file </option> ");<br />Else<br />Document. write ("<option value = \" "+ csss [I] +" \ ">" + csss [I] + "style sheet file </option> ");<br /></Script><br /></Select><br /></BODY><br /></HTML></p>
Tip: you can modify some code before running
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.