-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathIndex.html
45 lines (39 loc) · 1.21 KB
/
Index.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
<html>
<head>
<link rel="stylesheet" type="text/css" href="Index.css">
</head>
<body>
<div class="pentagram">
<span class="clef treble-clef"></span>
<hr>
<hr>
<hr>
<hr>
<hr>
</div>
<div class="pentagram">
<span class="clef bass-clef"></span>
<hr>
<hr>
<hr>
<hr>
<hr>
</div>
<script type="text/javascript" src="Index.js"></script>
<script>
let pentagrams = document.querySelectorAll(".pentagram");
let note = getRandomNote();
let pentagram = pentagrams[note.pentagram];
pentagram.appendChild(note.element);
document.addEventListener("keydown", keyDown);
function keyDown(e) {
if (e.key == note.key) {
pentagram.removeChild(pentagram.lastChild);
note = getRandomNote();
pentagram = pentagrams[note.pentagram];
pentagram.appendChild(note.element);
}
}
</script>
</body>
</html>