源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

javascript操作cookie_获取与修改代码

  • 时间:2021-11-22 18:07 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:javascript操作cookie_获取与修改代码
[u]复制代码[/u] 代码如下:
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 };
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部