扩展Jquery cookie插件
来源:互联网 发布:免费seo软件 编辑:程序博客网 时间:2024/05/17 05:55
啥也不说了,上代码:
/** * 扩展了jQuery cookie */jQuery.cookie = function(name, value, options) { if (typeof value != 'undefined') { options = options || {}; if (value === null) { value = ''; options = $.extend({}, options); options.expires = -1; } var expires = ''; if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) { var date; if (typeof options.expires == 'number') { date = new Date(); date.setTime(date.getTime() (options.expires * 24 * 60 * 60 * 1000)); } else { date = options.expires; } expires = '; expires='+ date.toUTCString(); // use expires attribute, max-age is not supported by IE } var path = options.path ? '; path=' (options.path) : ''; var domain = options.domain ? '; domain=' (options.domain) : ''; var secure = options.secure ? '; secure' : ''; document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join(''); } else { // only name given, get cookie return getCookie(name); }};/** * 获取Cookie值 */function getCookie(b) {var d = b + "=";var e = document.cookie.indexOf(d);if (e == -1) {return null;}var a = document.cookie.indexOf(";", e + d.length);if (a == -1) {a = document.cookie.length;}var c = document.cookie.substring(e + d.length, a);return unescape(c);}
调用方式
jQuery.cookie("__jforumSSOCookieNameUser__","test");
2 0
- 扩展Jquery cookie插件
- jQuery.cookie插件 cookie
- jQuery.cookie插件 cookie
- jQuery插件 -- Cookie插件
- jQuery插件 -- Cookie插件jquery.cookie.js
- jQuery插件 -- Cookie插件jquery.cookie.js
- jQuery插件 -- Cookie插件jquery.cookie.js
- jQuery插件 -- Cookie插件jquery.cookie.js
- Cookie操作插件 jQuery.Cookie
- Cookie操作插件 jQuery.Cookie
- jQuery-Cookie.插件运用
- jQuery - plugin插件 - Cookie
- Jquery中的Cookie插件
- jQuery插件:操作cookie
- jQuery.Cookie插件源码
- JQUERY---cookie插件用法
- Jquery插件cookie操作
- jQuery插件之Cookie
- cocos2dx android版本移植时的Error format not a string literal and no format arguments解决方案
- Ng机器学习课程Notes学习及编程实战系列-Part 1 Linear Regression
- thinkphp3.2add操作在有数据库,但没有表的情况下无任何错误提示
- 三 手游开发神器 cocos2d-x editor 之基础工具 intellij idea
- 2001
- 扩展Jquery cookie插件
- 设置UILabel的背景色为透明
- [Java] 反射机制 02 - Good!
- Android 音乐播放器的实现(二)界面的实现
- MySql计算两个日期的时间差函数
- apache+tomcat集群处理
- User-agent 类型汇总
- linux下程序烧写(dnw+minicom)
- POJ 2411 Mondriaan's Dream