jquery.cookie.js 用法

  <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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章