-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
45 lines (35 loc) · 1.02 KB
/
app.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
var ttime=document.getElementById("totalcount");
var count=0;
ttime.innerHTML = count;
let colors=[
"LightPink",
"Orange",
"peachpuff",
"chocolate",
"SlateBlue",
"Teal",
"LightGray",
"Aquamarine"
];
for (let i = 1; i < 16; i++) {
let ballon=document.getElementById(`ballon-${i}`);
ballon.style.background=colors[Math.floor(Math.random() * colors.length)];
}
var findcolor=colors[Math.floor(Math.random()*colors.length)];
console.log(findcolor);
document.getElementById("color").innerText=findcolor;
function nextcolor() {
findcolor=colors[Math.floor(Math.random()*colors.length)];
console.log(findcolor);
document.getElementById("color").innerText=findcolor;
}
function findbal(balloon) {
var ballon=document.getElementById(balloon);
// console.log("redddd",ballon.style.background);
if (findcolor.toLowerCase() === ballon.style.background) {
alert("color found");
count++;
ttime.innerHTML = count;
ballon.style.display="none";
}
}