1blue=document.getElementsByClassName("check1")[0]
2red=document.getElementsByClassName("check2")[0]
3yellow = document.getElementsByClassName("check3")[0]
4function colors(color) {
5 document.body.style.backgroundColor = color;
6}
7 blue.addEventListener("click", e => {
8 if (blue.checked) {
9 colors("blue")
10 }
11 else if (red.checked) {
12 colors("red")
13 }
14 else if (yellow.checked) {
15 colors("yellow")
16 }
17 else {
18 colors("white")
19 }
20 })
21
22red.addEventListener("click", e => {
23 if (red.checked) {
24 colors("red")
25 }
26 else if (blue.checked) {
27 colors("blue")
28 }
29 else if (yellow.checked) {
30 colors("yellow")
31 }
32 else {
33 colors("white")
34 }
35})
36yellow.addEventListener("click", e => {
37 if (yellow.checked) {
38 colors("yellow")
39 }
40 else if (red.checked) {
41 colors("red")
42 }
43 else if(blue.checked){
44 colors("blue")
45 }
46 else {
47 colors("white")
48 }
49})
50