A common example of css| dynamic is that there are multiple page styles on a site that provide viewers with choices.
Also, when you select a style and then open the page again, the style remains.
Naturally think of Cookie technology
Here is the HTML code section (plus the CSS file you need to use):
<HTML>
<HEAD>
<link id= "Skin" rel= "stylesheet" type= "Text/css" >
<TITLE> Skin-changing technology </TITLE>
<script language=javascript>
<!--
function Setcookie (name,value) {
var argv=setcookie.arguments;
var argc=setcookie.arguments.length;
var expires= (2<ARGC) argv[2]:null;
var path= (3<ARGC) argv[3]:null;
var domain= (4<ARGC) argv[4]:null;
var secure= (5<ARGC) Argv[5]:false;
document.cookie=name+ "=" +escape (value) + (expires==null)? ":("; Expires= "+expires.togmtstring ()) + (Path==null)" ":("; Path= "+path") + (domain==null)? ":("; domain= "+domain)" + ((secure==true)? "; Secure ":" ");
}
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;
The following set the cookie time is 1 years, oneself casually set that time.
Setcookie ("Nowskin", Url,expdate, "/", null,false);
}
}
-->
</SCRIPT>
</HEAD>
<BODY>
<P> Please select the dropdown menu below to test the skin effect </P>
<a href=# >css.css</a>
<a href=# >css1.css</a>
<a href=# >css2.css</a>
<a href=# >css3.css</a>
<br>
<select >
<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>