首页 > 代码库 > localStorage 设置本地缓存

localStorage 设置本地缓存

var timestamp = parseInt(Date.parse(new Date()));
var btn = document.getElementById("close");
btn.addEventListener("click", function(e){
document.getElementById(‘common_footer‘).style.display=‘none‘;
localStorage.clicktime = timestamp;
}, false);
if((timestamp - localStorage.clicktime) < 86400000){
document.getElementById(‘common_footer‘).style.display=‘none‘;
}

localStorage 设置本地缓存