作家
登录

javascript操作cookie_获取与修改代码

作者: 来源:www.28hudong.com 2013-03-30 02:35:54 阅读 我要评论

复制代码 代码如下: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 };

  推荐阅读

  各种常用浏览器getBoundingClientRect的解析

先上测试代码 复制代码 代码如下:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UT>>>详细阅读


本文标题:javascript操作cookie_获取与修改代码

地址:http://www.17bianji.com/kaifa2/JS/28682.html

关键词: 探索发现

乐购科技部分新闻及文章转载自互联网,供读者交流和学习,若有涉及作者版权等问题请及时与我们联系,以便更正、删除或按规定办理。感谢所有提供资讯的网站,欢迎各类媒体与乐购科技进行文章共享合作。

网友点评
自媒体专栏

评论

热度

精彩导读
栏目ID=71的表不存在(操作类型=0)