-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjjj.js
47 lines (44 loc) · 1.38 KB
/
jjj.js
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
46
47
for (let i = 0; i < document.querySelectorAll(".drum").length; i++) {
document.querySelectorAll(".drum")[i].addEventListener("click", function () {
var buttonInnerHTML = this.innerHTML;
switch (buttonInnerHTML) {
case "W":
let audio = new Audio("a.mp3");
audio.play();
break;
case "A":
let audio1 = new Audio("b.mp3");
audio1.play();
break;
case "S":
let audio2 = new Audio("c.mp3");
audio2.play();
break;
case "D":
let audio3 = new Audio("d.mp3");
audio3.play();
break;
case "M":
let audio4 = new Audio("e.mp3");
audio4.play();
break;
case "N":
let audio5 = new Audio("f.mp3");
audio5.play();
break;
case "O":
let audio6 = new Audio("g.mp3");
audio6.play();
break;
case "T":
let audio9 = new Audio("c.mp3");
audio9.play();
break;
default:
console.log(buttonInnerHTML);
}
});
}
document.addEventListener("keypress", function(event){
console.log(event);
});