jquery.cookie.js用法

来源:互联网 发布:淘宝客优惠券源码 编辑:程序博客网 时间:2024/05/05 16:02

  <script type="text/javascript" src="/js/jquery.cookie.js"></script>

 

  $.cookie('the_cookie'); // get cookie
  $.cookie('the_cookie', 'the_value'); // set cookie
  $.cookie('the_cookie', 'the_value', { expires: 7 }); // set cookie with an expiration date seven days in the future
  $.cookie('the_cookie', '', { expires: -1 }); // delete cookie

 

 

$.cookie('the_cookie'); //读取Cookie值
$.cookie(’the_cookie’, ‘the_value’); //设置cookie的值
$.cookie(’the_cookie’, ‘the_value’, {expires: 7, path: ‘/’, domain: ‘jquery.com’, secure: true});//新建一个cookie 包括有效期 路径 域名等
$.cookie(’the_cookie’, ‘the_value’); //新建cookie
$.cookie(’the_cookie’, null); //删除一个cookie

0 0