1 /*设置与获取Cookie*/
 2 var Cookie ={}
 3 Cookie.write = function(key, value, duration){
 4 var d = new Date();
 5 d.setTime(d.getTime()+1000*60*60*24*30);
 6 document.cookie = key + "=" + encodeURI(value) + "; expires=" + d.toGMTString();
 7 };
 8 Cookie.read = function(key){
 9 var arr = document.cookie.match(new RegExp("(^| )"+key+"=([^;]*)(;|$)"));
10 if(arr != null)
11 return decodeURIComponent(arr[2]);
12 return "";
13 };

 

 posted on 2013-07-24 15:29  ︷起↘嚸.  阅读(313)  评论(0编辑  收藏  举报