浏览器缓存小结

var diskAttributesMap = {};//想要存的值放到一个map中
var keyList = [ "currObjId", "currObjParId", "level", "status","left", "top"];
function setOperaterDiskMap (currObjId,currObjParId,level,status,left,top,clickText) {
debugger;
diskAttributesMap = JSON.parse(localStorage.getItem("diskAttributeVals"));
if (diskAttributesMap == null) {
diskAttributesMap = {};
}
diskAttributesMap["currObjId"] = currObjId;
diskAttributesMap["currObjParId"] = currObjParId;
diskAttributesMap["level"] = level;
diskAttributesMap["status"] = status;
diskAttributesMap["left"] =left;
diskAttributesMap["top"] = top;
diskAttributesMap["clickText"] = clickText;

localStorage.removeItem("diskAttributeVals");
localStorage.setItem("diskAttributeVals", JSON.stringify(diskAttributesMap));

}

你可能感兴趣的:(浏览器缓存小结)