欢迎您访问我爱IT技术网,今天小编为你分享的javascript教程:【jquery插件如何使用 jQuery操作Cookie插件使用介绍】,下面是详细的讲解!
jquery插件如何使用 jQuery操作Cookie插件使用介绍
jQuery.cookie=function(name, value, options) {
if (typeof value !='undefined') { // name and value given, set cookie
options=options || {};
if (value===null) {
value='';
options=$.extend({}, options); // clone object since it's unexpected behavior if the expired property were changed
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
}
// NOTE Needed to parenthesize options.path and options.domain
// in the following expressions, otherwise they evaluate to undefined
// in the packed version for some reason...
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
var cookieValue=null;
if (document.cookie && document.cookie !='') {
var cookies=document.cookie.split(';');
for (var i=0; i < cookies.length; i ) {
var cookie=jQuery.trim(cookies[i]);
// Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length 1)==(name '=')) {
cookieValue=decodeURIComponent(cookie.substring(name.length 1));
break;
}
}
}
return cookieValue;
}
};
关于jquery插件如何使用 jQuery操作Cookie插件使用介绍的用户互动如下:
相关问题:jQuery插件如何使用
答:这样引入 >>详细
相关问题:请教Jquery插件的使用方法
答: $(’#my-timeline’).timelinexml({ src : ‘timeline.xml’ }); >>详细
相关问题:jquery 插件怎么使用?
答:jQuery的插件使用方法具体步骤如下: 一、调用库文件 使用jQuery必须链接jQuery的库文件,无论是压缩版还是正常版,必须至少在网页中链接一个,如: 二、调用Jquery插件 应用做好的jQuery插件效果。 比如jQuery官网制作的插件jQuery,在使用它时... >>详细
- 【firefox】firefox浏览器不支持innerText的解决
- 【Extjs】Extjs学习过程中新手容易碰到的低级错误
- 【clearInterval】js clearInterval()方法的定义
- 【dom】javascript dom追加内容实现示例-追加内容
- 【checkbox】让checkbox不选中即将选中的checkbox
- 【Array】js中更短的 Array 类型转换-类型转换
- 【append】append和appendTo的区别以及appendChil
- 【ExtJs】ExtJs 表单提交登陆实现代码-表单提交-
- 【addClass】javascript自定义的addClass()方法
- 【Event】jquery下为Event handler传递动态参数的
- 评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)
-
