function setCookies(sName,sValue,oExpires,sPath,sDomain,bSecure){
    
var sCookie=sName+"="+ encodeURIComponent(sValue);
    
if(oExpires){
        sCookie
+="; expires="+oExpires.toGMTString();
    }
    
if(sPath){
        sCookie
+=";path="+sPath;        
    }
    
if(sDomain){
        sCookie
+=";domain="+sDomain;
    }
    
if(bSecure){
        sCookie
+=";secure";
    }
    document.cookie
=sCookie;
}

function getCookie(sName){
    
var sRE="(?:;)?"+sName+"=([^;]*);?";
    
var oRE=new RegExp(sRE);
    
if(oRE.test(document.cookie)){
        
return decodeURIComponent(RegExp["$1"]);
    }
    
else{
        
return null;
    }
}

function deleteCookie(sName,sPath,sDomain){
    setCookies(sName,
"",new Date(0),sPath,sDomain);
}

相关文章:

  • 2021-05-25
  • 2021-12-25
  • 2021-09-09
  • 2021-07-15
  • 2021-11-07
  • 2021-06-08
猜你喜欢
  • 2021-06-12
  • 2022-12-23
  • 2022-12-23
  • 2021-12-04
  • 2021-06-10
相关资源
相似解决方案