頁面有多個CSS做個check box讓使用者選擇

來源:互聯網
上載者:User
提示:您可以先修改部分代碼再運行

<p><HTML><br /><HEAD><br /><TITLE>換膚技術新的嘗試</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 />                                   //以下設定COOKIES時間為1年,自己隨便設定該時間..<br />           SetCookie("nowskin",url,expdate,"/",null,false);<br />     }<br />}<br />//--><br /></SCRIPT><br /></HEAD><br /><BODY></p><p><P>請選擇下面的下拉式功能表測試換膚效果</P></p><p><select onchange="changecss(this.value)"><br /><option>選擇樣式單檔案</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]+"樣式單檔案</option>");<br />     else<br />           document.write("<option value=\""+csss[i]+"\">"+csss[i]+"樣式單檔案</option>");<br /></script><br /></select><br /></BODY><br /></HTML></p>
提示:您可以先修改部分代碼再運行
相關文章

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.