cookie

var Days = 30;
var exp = new Date(); 
exp.setTime(exp.getTime() + Days*24*60*60*1000);
//删除cookie 
//exp.setTime(exp.getTime()-10000);
//document.cookie="userId=878,44,66;expires=" + exp.toGMTString();
//document.cookie="userName=ddd,jj,ff;expires=" + exp.toGMTString();
//var cookie =  document.cookie;
//alert(cookie);
//document.cookie="getOrderPlate=" + escape("上海市虹口区,上海市闸北区,北京市东城区") + ";expires=" + exp.toGMTString();

var start = document.cookie.indexOf('getOrderPlate=');
        if (start == -1) { 
        } else {
        var end = document.cookie.indexOf(";", start);
        if (end == -1) 
       
        end = document.cookie.length;
        }
        var len = end - start;
        var getOrderPlateStr = document.cookie.substr(start,len);
        // 地址数据 
        var getOrderPlateStr = unescape(getOrderPlateStr.substr(getOrderPlateStr.indexOf('=') + 1, getOrderPlateStr.length - getOrderPlateStr.indexOf('=') + 1));
       
        getOrderPlaceArray = getOrderPlateStr.split(",");
        }

你可能感兴趣的:(cookie)