拿走即用
使用前引入文件:http://files.cnblogs.com/ccto/util-cookie.js
使用方法:
//设置cookie CookieUtil.set("name", "xiaoMo"); CookieUtil.set("util", "cookie"); //读取cookie CookieUtil.get("name"); CookieUtil.get("util"); //删除cookie CookieUtil.unset("name"); CookieUtil.unset("util"); //设置cookie 包括路径、域、失效日期 CookieUtil.set("name", "xiaoMo", '/path1/path2/', "www.abc.com", new Date('January 12,2015')); //删除上面设置的cookie CookieUtil.unset("name", '/path1/path2/', "www.abc.com"); //设置安全cookie CookieUtil.set("name", "xiaoMo", null, null, null, true);