首页 > 代码库 > javascript cookie

javascript cookie

function setCookie(cname,cvalue){    document.cookie=cname+"="+cvalue;} function getCookie(cname){    var cookie=document.cookie;    var beg=cookie.indexOf(cname+"=");    if(beg<0) return "";    var end=cookie.substr(beg).indexOf(‘;‘);    if(end<0) end=cookie.length;    else end=beg+end;    return cookie.substring(beg+cname.length+1,end);}

 

javascript cookie