выделяются сразу все, не совсем то
<input type="checkbox" id="check1">
<input type="checkbox" id="check2">
<input type="checkbox" id="check3">
(function(){
var check = document.querySelectorAll('input');
for (var z = 0, checkid; checkid = check[z]; z++) {
if (localStorage[checkid.id] !== undefined) {
checkid.checked = localStorage[checkid.id];
}
checkid.onchange = function() {
localStorage[this.id] = this.checked;
}
}
})()