我当前正在尝试保存是否有人选中了HTML复选框并用Java中的localStorage
保存它。请仔细阅读这段代码,并告诉我这些错误。
<!DOCTYPE html>
<html>
<head>
<script>
var CheckBox = document.getElementById("Box");
if(localStorage.Box1 == 1) {
document.getElementById("Blank").innerHTML = "Hello";
}
function Box() {
if(CheckBox.check) {
localStorage.Box1 = 1;
} else {
localStorage.Box1 = 0;
}
}
</script>
</head>
<body>
<input type="checkbox" id="Box" onclick="Box()">
<p id="Blank"></p>
</body>
</html>