Jquery.cookie 插件

 

使用教程



Create session cookie:
    $.cookie('the_cookie', 'the_value');

Create expiring cookie, 7 days from then:
    $.cookie('the_cookie', 'the_value', { expires: 7 });

Create expiring cookie, valid across entire site:
    $.cookie('the_cookie', 'the_value', { expires: 7, path: '/' });

Read cookie:
    $.cookie('the_cookie'); // => "the_value"
    $.cookie('not_existing'); // => null

Delete cookie:
    // Returns true when cookie was found, false when no cookie was found...
    $.removeCookie('the_cookie');
    // Same path as when the cookie was written...
    $.removeCookie('the_cookie', { path: '/' });

 

 

posted @ 2013-01-09 22:34  子夏子  阅读(158)  评论(0编辑  收藏  举报
yokoboy