-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
84 lines (72 loc) · 1.91 KB
/
script.js
File metadata and controls
84 lines (72 loc) · 1.91 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
var arr = [
{
team : "RCB",
captain : "Virat Kohli",
origin : "Bangalore",
primary : "RCB.png",
secondry : "Black",
wins : 2
},
{
team : "MI",
captain : "Rohit Sharma",
origin : "Mumbai",
primary : "MI.jpg",
secondry : "Silver",
wins : 5
},
{
team : "KKR",
captain : "Dinesh Karthik",
origin : "Kolkata",
primary : "KKR.jpg",
secondry : "Gold",
wins : 2
},
{
team : "SRH",
captain : "Kane Williamson",
origin : "Hyderabad",
primary : "SRH.jpg",
secondry : "Black",
wins : 1
},
{
team : "CSK",
captain : "MS Dhoni",
origin : "Chennai",
primary : "CSK.png",
secondry : "Blue",
wins : 4
},
{
team : "DC",
captain : "Rishabh Pant",
origin : "Delhi",
primary : "DC.jpg",
secondry : "Red",
wins : 0
},
{
team : "PBKS",
captain : "Mayank Agarwal",
origin : "Punjab",
primary : "PBKS.png",
secondry : "Red",
wins : 0
}
]
let btn = document.querySelector("button");
let h1 = document.querySelector("h1");
let main = document.querySelector("main");
let video = document.querySelector("video");
btn.addEventListener("click", function(){
btn.style.color = "rgb(17, 9, 9)";
btn.style.boxShadow = "0 0 10px rgba(17, 16, 16, 0.2)";
let winner = arr[Math.floor(Math.random() * arr.length)];
h1.innerHTML = winner.team + " has won " + winner.wins + " times in IPL!" + winner.captain + " is the captain of this team from " + winner.origin + ".";
// main.style.backgroundColor = winner.primary;
main.style.backgroundImage = `url(${winner.primary})`;
main.style.color = winner.secondry;
video.style.display = "none";
})