-
Notifications
You must be signed in to change notification settings - Fork 127
/
Copy pathindex.html
131 lines (86 loc) · 2.45 KB
/
index.html
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
130
131
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Cricket_Game</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="box1">
<h1 >Ball Bat Stump Game</h1>
<button class="game_buttons" onclick="
let usermsg='Bat';
let computerchoice=computergeneratechoice();
let cmpmsg=computerchoice;
let result=getresult(usermsg,computerchoice);
/*
if(computerchoice==='Bat'){
result='both are tie';
}
else if(computerchoice ==='Ball'){
result='user won';
}
else{
result='computer won';
}
*/
// alert(`${usermsg} \n ${cmpmsg} \n the result is ${result}`);
showresult(usermsg,cmpmsg,result);
">
<img src="bat.jpeg" class="game_image" alt="Bat_button">
</button>
<button class="game_buttons" onclick="
usermsg='Ball';
computerchoice=computergeneratechoice();
cmpmsg=computerchoice;
result=getresult('Ball',computerchoice);
/*
if(computerchoice==='Bat'){
result='computer won';
}
else if(computerchoice ==='Ball'){
result='its a tie';
}
else{
result='user won';
}
*/
// alert(`${usermsg} \n ${cmpmsg} \n the result is ${result}`);
showresult(usermsg,cmpmsg,result);
"> <img src="ball.jpeg" class="game_image" alt="Ball_button"> </button>
<Button class="game_buttons" onclick="
usermsg='stump';
computerchoice=computergeneratechoice();
cmpmsg=computerchoice;
result=getresult('stump',computerchoice);
/*
if(computerchoice==='Bat'){
result='user won';
}
else if(computerchoice ==='Ball'){
result='computer won';
}
else{
result='tie';
}
*/
//alert(`${usermsg} \n ${cmpmsg} \n the result is ${result}`);
showresult(usermsg,cmpmsg,result);
"> <img src="wickets.jpeg" class="game_image" alt="wickets_button"> </Button>
<!-- use moves and results in a heading type instead of using alert.. -->
<div class="show">
<h2 id="user-move"></h2>
<h2 id="computer-move"></h2>
<h2 id="result"></h2>
<h2 id="score"></h2>
</div>
<button onclick="localStorage.clear()
resetscore(); //undefind value.. //without this function ,only the values in storage location can be changed..
//using reset function we can also so in alert notification
" id="reset"> RESET </button>
</div>
<!-- added script -->
<script src="script.js"></script>
</body>
</html>