-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
34 lines (22 loc) · 913 Bytes
/
script.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
const buttons=document.querySelectorAll('.button');
const body=document.querySelector('body');
buttons.forEach((button)=>{
button.addEventListener('click',(e)=>{
switch (e.target.id) {
case 'grey':
body.style.backgroundColor=e.target.id;
case 'yellow':
body.style.backgroundColor=e.target.id;
case 'blue':
body.style.backgroundColor=e.target.id;
case 'white':
body.style.backgroundColor=e.target.id;
case 'purple':
body.style.backgroundColor=e.target.id;
case 'orange':
body.style.backgroundColor=e.target.id;
default:
break;
}
})
})