-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
129 lines (93 loc) · 2.28 KB
/
script.js
File metadata and controls
129 lines (93 loc) · 2.28 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
// window.setTimeout(function(){
// var arr=[];
// var input= prompt("solluda");
// while(input!=="quit")
// {
// if(input==="new"){
// var kk=prompt("inaah");
// arr.push(kk);
// console.log(kk +" added to list");
// }
// else if (input==="list"){
// arr.forEach(function(color,gg){
// console.log(gg +":"+color);
// });
// }
// else if (input==="del"){
// var ind=prompt("number tell");
// arr.splice(ind,1);
// console.log("removed");
// }
// input= prompt("solluda");}
// },500);
// function prar(arr){
// for(var i=arr.length-1 ; i>=0 ; i--){
// console.log(arr[i]);
// }
// };
// var arr=[
// { title:"as",
// rate:5,
// yn:true},{ title:"aas",
// rate:4.5,
// yn:true},{ title:"kk",
// rate:4,
// yn:false}
// ];
// arr.forEach(function(color){
// if(color.yn===true){
// var k="have watched";
// }
// else{
// var k="not seen";
// }
// console.log("you "+k+"sjsj "+color.title+":"+color.rate);
// });
// var jn= document.querySelector("button");
// var hd= document.querySelector("p");
// jn.addEventListener("click", function(){
// hd.textContent="mamamamamam";
// });
// var lis= document.querySelectorAll("li");
// for( var i=0;i<lis.length;i++){
// lis[i].addEventListener("click",function(){
// this.style.color = this.style.color === "blue" ? "black":"blue";
// });}
var pla= document.getElementsByClassName("ll");
var k=0;
var m=0;
var b=0;
var p1=document.querySelector("#p1");
var p2=document.querySelector("#p2");
var dro=document.querySelector("h5");
var res=document.getElementById("kk");
var pla1=document.getElementById("ss");
var pla2=document.getElementById("dd");
var inp=document.querySelector("input");
var state=false;
inp.addEventListener("input",function(e){
dro.textContent= "playing to:"+e.target.value;
b=Number(e.target.value);
})
pla1.addEventListener("click",function(){
if(!state){
k++;
if(k===b){ state=true; p1.classList.add("gree");}
p1.textContent= k;}
});
pla2.addEventListener("click",function(){
if(!state){ m++;
if(m===b){state=true; p2.classList.add("gree");}
p2.textContent= m;}
});
res.addEventListener("click",function(){
k=0;
m=0;
b=0;
p1.textContent= k;
p2.textContent= m;
state=false;
dro.textContent="playing for:"+ inp.value;
p1.classList.remove("gree");
p2.classList.remove("gree");
})