你可以在设置时指定cookie的Path属性

解决方案 »

  1.   

    汗!自己有资料竟然没去细看~~
    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.
      

  2.   

    应该怎样设置Cookie的路径?如下设置无法保存Cookiedocument.cookie = name + "=" + escape(value) +";expires=" + exp.toGMTString() + ";domain='www.163.com';path='/'" ;
      

  3.   

    也就是说,加了Domain和Path后,无法设置Cookie的值。
      

  4.   

    "; expires="
    用分号加空格才能隔开
      

  5.   

    supNate(铅笔) ( ) 信誉:98 
    你的方法我试了,也不行,还是不能设置Cookie值。
      

  6.   

    document.cookie  =  name  +    "=  "  +  escape(value)  +  ";expires=  "  +  exp.toGMTString()  +    ";path=/  "  ; 这样没问题了。谢谢各位的指点。谢谢。