cookie js案例
//存cokie
function setcookie(keys,value,time){
document.cookie=keys+"="+decodeURIComponent(value)+"domain=127.0.0.1;max-age="+time;
}
cookie的案例
//取cookie
function getcookie(keys){
var arr=document.cookie.split(";");
for(var i=0;i<arr.length;i++){
var ass=arr[i].split("=");
if(ass[0].trim()==keys){
return ass[1];
}
}
return false;
}
//删cookie
function delcookie(){
var arr=document.cookie.split(";");
for(var i=0;i<arr.length;i++){
var ass=arr[i].split("=");
document.cookie=ass[0]+"=;max-age=0"
}
}