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 };
,这个送给你!