-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.html
45 lines (39 loc) · 1.19 KB
/
main.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<!DOCTYPE html>
<head>
<title>Grade Summary</title>
<link rel="stylesheet" href="site.css">
</head>
<body>
<h4>Grade Summary App</h4>
<h1>Enter Grades</h1>
<div class="form-layout">
<div class="form-element">
<input id="grade" />
</div>
<div class="form-element">
<input type="button" onclick="add()" value="Add" />
</div>
</div>
<div class="form-layout">
<button id="showSummary" onclick="showSummary()">Show Summary</button>
</div>
<div class="form-layout">
<button id="clear" onclick="clear()">Clear</button>
</div>
<script type="application/javascript">
const grades = [];
function add() {
let grade = document.getElementById("grade").value;
grades.push(grade);
document.getElementById("grade").value="";
document.getElementById("grade").focus();
}
function clear() {
grades = [];
}
function showSummary() {
localStorage.setItem("gradeArray", grades);
window.open("summary.html", "_self");
}
</script>
</body>