您的位置:首页 > Web前端 > JQuery

jquery.cookie.js的用法

2011-09-22 10:04 369 查看
jquery.cookie.js是jQuery的一个插件,其基本用法如下:

 

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

  $.cookie('the_cookie'); // getcookie

  $.cookie('the_cookie', 'the_value'); // setcookie

  $.cookie('the_cookie', 'the_value', { expires: 7}); // set cookie with an expiration date seven days in thefuture

  $.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


<script>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  jquery domain date path null