- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjavascript.js
More file actions
Latest commit
79 lines (75 loc) · 2.51 KB
/
Copy pathjavascript.js
File metadata and controls
79 lines (75 loc) · 2.51 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
varradio3=document.getElementsByName("radioname3");
varradio1=document.getElementsByName("radioname1");
varradio2=document.getElementsByName("radioname2");
functionscore(){
varresult=0;
result=result+1;
document.getElementById('score').textContent=result;
}
functionEgal(){
varplayagain=document.getElementById("play-again");
if(((radio2[0].style.display=='block')&&(radio3[0].style.display=='block'))||
((radio2[1].style.display=='block')&&(radio3[1].style.display=='block'))||
((radio2[2].style.display=='block')&&(radio3[2].style.display=='block'))){
playagain.textContent="TRY";
playagain.style.backgroundColor="hsl(229, 96%, 51%)";
playagain.style.fontSize="30px";
playagain.style.color="white";
}
}
functionYou_Win(){
varpicked2=document.getElementById("picked2");
if(((radio2[0].style.display=='block')&&(radio3[1].style.display=='block'))||
((radio2[1].style.display=='block')&&(radio3[2].style.display=='block'))||
((radio2[2].style.display=='block')&&(radio3[0].style.display=='block'))){
picked2.textContent="YOU WIN";
picked2.style.color="rgb(38, 226, 38)";
picked2.style.textShadow="0 0 10px white";
score();
}
}
functionYou_Lost(){
varpicked2=document.getElementById("picked2");
if(((radio2[1].style.display=='block')&&(radio3[0].style.display=='block'))||
((radio2[2].style.display=='block')&&(radio3[1].style.display=='block'))||
((radio2[0].style.display=='block')&&(radio3[2].style.display=='block'))){
picked2.textContent="YOU LOST";
picked2.style.color="rgb(231, 47, 47)";
picked2.style.textShadow="0 0 10px white";
}
}
functioncpuChois(){
varindex=Math.floor(Math.random()*3);
Math.floor(Math.random()*3);
if(index==0)
radio3[0].style.display='block';
else{
if(index==1)
radio3[1].style.display='block';
else
radio3[2].style.display='block';
}
}
functionjouer(){
document.getElementById('form1').style.display='none';
if(radio1[0].checked)
radio2[0].style.display="block";
else{
if(radio1[1].checked)
radio2[1].style.display="block";
else
radio2[2].style.display="block";
}
document.getElementById('form2').style.display='block';
cpuChois();
You_Win();
You_Lost();
Egal();
}
functionrules(){
form=document.getElementById('form-popup');
form.style.display="block";
}
functionplay_again(){
location.reload();
}