Jquery-cookie-1.4.1【jquery.cookie.js】

发布者:梦幻一新科技 发布时间:2015-07-24 22:04:37 阅读次数:1367



使用方法:
1、设置 cookie:
$.cookie('the_cookie', 'the_value');
//注:如果 $.cookie 没有第三个参数,那么当浏览器关闭时,该 cookie 将会自动删除。


2、设置一个有效期为 7 天的 cookie:
$.cookie('the_cookie', 'the_value', {expires: 7});
//注:$.cookie 第三个参数是一个对象,除了可以设置有效期(expires: 7),还可以设置有效路径(path: '/')、有效域(domain: 'jquery.com')及安全性(secure: true)。


3、读取 cookie:
$.cookie('the_cookie');
//注:如果没有该 cookie,返回 null。


4、删除 cookie:
$.cookie('the_cookie', null);
//我们只需要给需要删除的 cookie 设置为 null,就可以删除该 cookie。 
喜欢
(0)
0%
一般
(0)
0%