function ClearCookie() { var expires = new Date(); expires.setTime(expires.getTime() - 1000); //当前时间减去一秒,相当于立即过期(可以增减) document.cookie = "appCode='222''';path=https://www.jb51.net/;expires=" + expires.toGMTString() + ""; //expires是对应过期时间的设置,不设这个值,cookie默认在关闭浏览器时失效 document.cookie = "roleID='333''';path=https://www.jb51.net/;expires=" + expires.toGMTString() + ""; document.cookie = "parentMenuID='000''';path=https://www.jb51.net/;expires=" + expires.toGMTString() + ""; document.cookie = "currentMenuName='哈哈''';path=https://www.jb51.net/;expires=" + expires.toGMTString() + ""; }
path=https://www.jb51.net/;表示cookie存放的位置是浏览器根目录
上述方法导致appCode,roleID,parentMenuID,currentMenuName4个cookie失效
您可能感兴趣的文章: