首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

[JS Cookie相关]希望高手能指点下异常,或给点思路吧。多谢各位,顶有分

2012-03-22 
[JS Cookie相关]希望高手能指点下错误,或给点思路吧。谢谢各位,顶有分htmlxmlns http://www.w3.org/1999

[JS Cookie相关]希望高手能指点下错误,或给点思路吧。谢谢各位,顶有分
<html   xmlns= "http://www.w3.org/1999/xhtml "   >
<head   runat= "server ">
        <link   id= "skin "   rel= "stylesheet "   type= "text/css "   />  
        <title> Cookie测试 </title>
          <script   language= "javascript "   type= "text/javascript ">    
                function   SetCookie(name,value,option)
                {
                        var   strCookie=name+ "= "+escape(value);
                        if(option)
                        {
                     
                                if(option.expireDays)
                                {
                                        var   date   =new   Date();
                                        var   now   =option.expireDays*24*3600*1000;
                                        date.setTime(date.getTime()+now);
                                        strCookie+= ";   expires= "+date.toUTCString();
                                }
                                if(option.path)
                                {
                                       
                                        strCookie+= ";   path= "+path;
                                }
                                if(option.domain)
                                {
                                        strCookie+= ";   domain= "+domain;
                                }
                                if(option.secure)


                                {
                                        strCookie+= ";   true ";
                                }
                      }
                      document.cookie=strCookie;            
                      debugger;
                }
                function   GetCookie(name)
                {
                        var   search=name+ "= ";
                        var   cookieval= " ";
                        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;
                                        cookieval=unescape(document.cookie.substring(offset,end));
                                }
                        }
                      return   cookieval;
                }
                //换肤相关的操作
                var   thisskin;
                thisskin=GetCookie( "nowskin ");
                if(thisskin!= " ")
                {
                        skin.href=thisskin;


                }
                else
                {
                        skin.href= "css4.css ";
                }
                function   changeCss(url)
                {
                        if(url!= " ")
                        {
                                skin.href=url;
                                SetCookie( "nowskin ",url,{expireDays:20,secure:true,path: "/cdddd "});
                        }
                }
        </script>
        </head>
<body>
<table>
<tr>
<td>
<li   onclick= "changeCss( 'css.css '); "   style= "color:#96C2F1; "> </li>
<li   onclick= "changeCss( 'css1.css '); "style= "color:#9BDF70; "> </li>
<li   onclick= "changeCss( 'css2.css '); "style= "color:#BBE1F1; "> </li>
<li   onclick= "changeCss( 'css3.css '); "style= "color:#CCEFF5; "> </li>
</td>
</tr>
</table>
</body>
</html>


[解决办法]
要做虾米呢?
[解决办法]

<li onclick= "changeCss( ' ', ' ', 'css.css '); " style= "color:#96C2F1; "> </li>

热点排行