-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
58 lines (45 loc) · 1.39 KB
/
index.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
48
49
50
51
52
53
54
55
56
57
function updateHomeScore(val) {
score = document.getElementById("homeScore").textContent;
val = Number(val);
let num = Number(score);
num += val;
document.getElementById("homeScore").textContent = num;
}
function resetHome() {
document.getElementById("homeScore").textContent = 0;
}
function updateGuestScore(val) {
score = document.getElementById("guestScore").textContent;
val = Number(val);
let num = Number(score);
num += val;
document.getElementById("guestScore").textContent = num;
}
function resetGuest() {
document.getElementById("guestScore").textContent = 0;
}
function updateGreen() {
document.body.style.background = "#064E3B";
document.documentElement.style.background = "#064E3B";
}
function updateBlue() {
document.body.style.background = "#0C4A6E";
document.documentElement.style.background = "#0C4A6E";
}
function updateRed() {
document.body.style.background = "#881337";
document.documentElement.style.background = "#881337";
}
function updateRandom() {
let ranOne = getRandomColor();
document.body.style.background = ranOne;
document.documentElement.style.background = ranOne;
}
function getRandomColor() {
const letters = '0123456789ABCDEF';
let color = '#';
for (let i = 0; i < 6; i++) {
color += letters[Math.floor(Math.random() * 16)];
}
return color;
}