1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| var Cookie = { get : function(name) { var value = ""; var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)")); if(arr != null) { value = unescape(arr[2]); } return value; }, set : function(name,value,days){ if(isNaN(days)){ document.cookie = name+"="+escape(value)+";"; }else{ document.cookie = name+"="+escape(value)+";expires="+new Date(new Date().getTime()+days*86400000).toGMTString(); } }, del : function(name){ document.cookie = name+"=;expires="+new Date().toGMTString(); } }
|