手机
当前位置:查字典教程网 >编程开发 >Javascript教程 >javascript操作cookie_获取与修改代码
javascript操作cookie_获取与修改代码
摘要:复制代码代码如下:function$Cookie(){vara=arguments.callee;varb=a._cached;if(a._...

复制代码 代码如下:

function $Cookie(){

var a=arguments.callee;

var b=a._cached;

if(a._cached){return a._cached}

if(!(this instanceof a)){return new a}

if(typeof a._cached=="undefined"){a._cached=this}

}

$Cookie.prototype.get=function(e){

var a=document.cookie.split(/s*;s*/);

var d=new RegExp("^(s*"+e+"s*=)");

for(var b=0;b<a.length;b++){

if(d.test(a[b])){return unescape(a[b].substr(RegExp.$1.length))}

}

return null

};

$Cookie.prototype.set=function(e,f,d,a){

var b="";

if(typeof d=="number"){b=";expires="+(new Date((new Date()).getTime()+d*1000*60*60*24)).toGMTString()}

if(typeof a=="undefined"){a=""}

document.cookie=e+"="+escape(f)+b+"; path=/"+(a?"; domain="+a:"");

return this

};

$Cookie.prototype.remove=function(a){

if(this.get(a)!=null){this.set(a,"",-1)}

return this

};

【javascript操作cookie_获取与修改代码】相关文章:

JavaScript中Cookies的相关使用教程

用javascript动态注释掉HTML代码

javascript中一些util方法汇总

Javascript随机显示图片的源代码

javascript操作表格

Javascript 高阶函数使用介绍

javascript操作ul中li的方法

JavaScript获取两个数组交集的方法

javascript判断并获取注册表中可信任站点的方法

javascript获取select值的方法分析

精品推荐
分类导航