将需要的信息本地存储住:给本地localStorage一个'strMenuKey'
if (window.localStorage) {
localStorage.setItem(strMenuKey, arrDisplay);
} else {
Cookie.write(strMenuKey, arrDisplay);
}
读取出来
var strStoreDate = window.localStorage? localStorage.getItem(strMenuKey): Cookie.read(strMenuKey);
但是这个是字符串形的,需要给变化为数组
strStoreDate.split(",").each(function(display, index) {
if (display.toInt() === 0) {
eleLeftMenuTit[index].fireEvent("click");
}
});
如果存储json数据,可以先data = json.stringify(a)
读取的时候用 json.parse(data)
http://www.zhangxinxu.com/wordpress/2011/09/html5-localstorage%E6%9C%AC%E5%9C%B0%E5%AD%98%E5%82%A8%E5%AE%9E%E9%99%85%E5%BA%94%E7%94%A8%E4%B8%BE%E4%BE%8B/ 参考文章