cookie 操作


function addCookie(name,value){
var destoryTime = new Date();
destoryTime.setTime(destoryTime.getTime() + 24 * 3600 * 1000);//过期时间
var expireTime = destoryTime.toGMTString();
document.cookie = name+"="+value+";expires=" + expireTime + ";path=/;";
}
function getCookie(name){
var strCookie=document.cookie;
var arrCookie=strCookie.split(";");
for(var i=0;i<arrCookie.length;i++){
var arr=arrCookie[i].split("=");
if($.trim(arr[0]) == name)return arr[1];
}
return "";
}

  function setcookies(value) {
addCookie("cmenu",value);
  }

你可能感兴趣的:(cookie)