setCookie: function(name, value, iDay){ //设置cookie: cookie名,cookie值,天数
var d = new Date(); iDay = iDay?iDay:30; d.setTime(d.getTime()+(iDay*24*60*60*1000)); document.cookie = name+"="+value+";expires="+d.toGMTString(); }, getCookie: function(name){ //获取cookie var arr = document.cookie.replace(' ','').split(';'); for(var i = 0; i < arr.length; i++) { var arr2 = arr[i].split('='); if(arr2[0] == name) { return arr2[1]; } } return ''; }, removeCookie: function(name){//删除cookie util.setCookie(name, 1, -1); }