• 网站样式切换效果


    <HTML>
    <HEAD>
    <link ID="skin" rel="stylesheet" type="text/css">
    <TITLE>换肤技术</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;
                                       //以下设置COOKIES时间为1年,自己随便设置该时间..
               SetCookie("nowskin",url,expdate,"/",null,false);
         }
    }
    //-->
    </SCRIPT>
    </HEAD>
    <BODY>

    <P>请选择下面的下拉菜单测试换肤效果</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>选择样式单文件</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]+"样式单文件</option>");
         else
               document.write("<option value=\""+csss[i]+"\">"+csss[i]+"样式单文件</option>");
    </script>
    </select>
    </BODY>
    </HTML>

  • 相关阅读:
    C# MenuStrip Visible=false bug的解决方案
    WTL 命令行编译
    LCS 最长公共字串算法实现
    调用系统打开文件OpenAs_RunDLL
    ToolStripSplitButton Checked 效果
    WTL 中使用GDI+ 备忘
    P7482 不条理狂诗曲 题解
    CF1557 比赛记录
    P2519 [HAOI2011]problem a 题解
    CF1540B Tree Array 题解
  • 原文地址:https://www.cnblogs.com/zlmlovem/p/1900038.html
Copyright © 2020-2023  润新知