jquery方法
$.cookie("userName", null);
$.cookie("passWord", null);
http://x.com/x.htm    清除成功
http://x.com/a/x.htm  清除失败js代码是没问题的,因为在根目录清除成功了,但不知道为什么在子目录下就无效

解决方案 »

  1.   

    忘了说明了,这个js代码写在/comm/comm.js然后在页面中调用
      

  2.   

    清除cookie不就是设置cookie的expires吗,没用过jquery的$.cookie方法。
      

  3.   

    将expires时间过期就好了,这个也一样,在一个根目录可以,但子文件夹不行
      

  4.   

    发现了,是path的问题,但不知道要怎么解决
      

  5.   

    或许这个对lz有帮助
    http://topic.csdn.net/u/20100827/22/2335d1ad-a335-4c5a-8391-1736c998ea46.html
      

  6.   

    cookie中保存和设置值的时候都有escape 、unescape编码过,path中的“/”也会编码的
      

  7.   

    Sets or retrieves the string value of a cookie.Syntaxdocument.cookie [ = sCookie ]
    Possible ValuessCookie String that specifies or receives the name=value; pairs, plus any of the values listed in Possible Values.
    expires=date;
    Setting no expiration date on a cookie causes it to expire when the browser closes. If you set an expiration date in the future, the cookie is saved across browser sessions. If you set an expiration date in the past, the cookie is deleted. Use GMT format to specify the date. 
     
    domain=domainname; 
    Setting the domain of the cookie allows pages on a domain made up of more than one server to share cookie information.  path=path;
    Setting a path for the cookie allows the current document to share cookie information with other pages within the same domain—that is, if the path is set to /thispathname, all pages in /thispathname and all pages in subfolders of /thispathname can access the same cookie information. 
     
    secure;
    Setting a cookie as secure; means the stored cookie information can be accessed only from a secure environment.