-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBasketballMathObjects.html
294 lines (269 loc) · 10.1 KB
/
BasketballMathObjects.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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
<!DOCTYPE html>
<html>
<head>
<link rel="shortcut icon" href="basketball_logo.png" type="image/png">
<title>Basketball | Average Points</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
</head>
<body>
<div class="jumbotron">
<div class="container text-center">
<h1><img src="basketball_header.webp" height="70">Basketball Players Score</h1>
</div>
</div>
<!--THIS IS FOR THE NABVAR AT THE BEGINNIG. If the home doesnt lead to anything that is because I didnt include index.html.
To view where the home leads to open this github website where it hosts all my code https://potato-man5.github.io/School_2024/BasketballMathObjects.html-->
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="potato_logo.png" target="_blank" rel="noreferrer" title="Logo" class="me-3 d-none d-md-inline-block"></a>
<img src="potato_logo.png" alt="Logo" height="50">
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<li><a href="index.html">Home</a></li>
</ul>
</div>
</div>
</nav>
<!--For the select to view each team's game and score on the scoreboard -->
<div class="playerScores" id="playerScoreTable">
<h1 class="sections">Teams and Scores</h1>
<div class="table">
<div class="dropDown">
<select id="positionSelect" onchange="updateContent()">
<option value="p_sGuard">P. guard | VS | S. guard</option>
<option value="center">center | VS | S. guard</option>
<option value="p_sForward">P. forawrd | VS | S. forward</option>
</select>
</div>
<div class="foulTable">
<table class="foul">
<tr>
<td class="leftFoul" id="foul1">2</td>
<td>FOULS</td>
<td class="rightFoul" id="foul2">5</td>
</tr>
</table>
</div>
<table class="scoreboard">
<tr>
<td class="city">Cembo Taguig City</td>
<td class="team" id="team1">P.guard</td>
<td class="score" id="score1">15.6</td>
<td class="team2" id="team2">S.guard</td>
<td class="score" id="score2">13.7</td>
<td class="quarter">4TH</td>
<td class="time">0:00</td>
</tr>
</table>
</div>
</div>
<hr>
<!-- For the statistics -->
<h1 class="sections">Statistics</h1>
<div class="mathObjects" id="mathObjectTask">
<h1>Rounded Off to Integer</h1>
<p>The score of the basketball team's score when rounded off can be seen in the following:</p>
<p id="pGuardAve"></p>
<p id="sGuardAve"></p>
<p id="centerAve"></p>
<p id="sFowardAve"></p>
<p id="pFowardAve"></p>
<h1>Lowest and Highest Rounded Off Score</h1>
<p>The team with the lowest number is the S. guard coming in at:</p>
<p id="lowestNumber"></p>
<p>Meanwhile the team with the highest score is the center:</p>
<p id="highestNumber"></p>
<h1>Total and Square Root</h1>
<p>Combined the total amount of points gotten by all of the teams equate to:</p>
<p id="totalRoundedScore"></p>
<p>And square rooting the total amount will result in the number:</p>
<p id="totalRoundedSqrt"></p>
</div>
</body>
<script>
<!--Variables for the math objects -->
var pGuard = 15.6;
var sGuard = 13.7;
var center = 20.7;
var sForward = 16.3;
var pForward = 12.9;
<!--For rounding off the variables -->
document.getElementById("pGuardAve").innerHTML = Math.round(pGuard);
document.getElementById("sGuardAve").innerHTML = Math.round(sGuard);
document.getElementById("centerAve").innerHTML = Math.round(center);
document.getElementById("sFowardAve").innerHTML = Math.round(sForward);
document.getElementById("pFowardAve").innerHTML = Math.round(pForward);
<!--Code to get the highest amd lowest number of the variables -->
document.getElementById("lowestNumber").innerHTML = Math.min(Math.round(pGuard, sGuard, center, sForward, pForward));
document.getElementById("highestNumber").innerHTML = Math.max(Math.round(pGuard, sGuard, center, sForward, pForward));
<!--Code to get the total number of the variables and to square root them -->
var totalRounded = Math.round(pGuard + sGuard + center + sForward + pForward);
document.getElementById("totalRoundedScore").innerHTML = totalRounded;
document.getElementById("totalRoundedSqrt").innerHTML = Math.sqrt(totalRounded);
<!--Entire code the for the select and option html tags which you can select the game and see the numbers got by each team-->
function updateContent() {
const select = document.getElementById("positionSelect");
const team1 = document.getElementById("team1");
const team2 = document.getElementById("team2");
const score1 = document.getElementById("score1");
const score2 = document.getElementById("score2");
const foul1 = document.getElementById("foul1");
const foul2 = document.getElementById("foul2");
if (select.value === "p_sGuard") {
team1.innerHTML = "P. guard";
team2.innerHTML = "S. guard";
score1.innerHTML = "15.6";
score2.innerHTML = "13.7";
foul1.innerHTML = "2";
foul2.innerHTML = "5";
} else if (select.value === "center") {
team1.innerHTML = "center";
team2.innerHTML = "S. forward";
score1.innerHTML = "20.7";
score2.innerHTML = "0";
foul1.innerHTML = "3";
foul2.innerHTML = "20";
} else if (select.value === "p_sForward") {
team1.innerHTML = "P. forward";
team2.innerHTML = "S. forward";
score1.innerHTML = "16.3";
score2.innerHTML = "12.9";
foul1.innerHTML = "8";
foul2.innerHTML = "1";
}
}
</script>
<style>
/* CSS for all elements in webpage */
body {
background-color: #eb7819;
margin: 0;
}
h1 {
color: #d9d1d1;
}
h1.sections {
color: #000000;
font-size: 40px;
padding-left: 30px;
font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
}
p {
font-size: 19px;
}
div.mathObjects {
padding-left: 10px;
font-family: Itim;
background-image: url(basketball_net.png);
background-position: right;
background-repeat: no-repeat;
background-size: 23%;
}
/* CSS for the select scoreboard in the beginning in the webpage */
div.dropDown {
padding-bottom: 35px;
font-size: 20px;
}
div.playerScores {
background-image: url(basketball_court.png);
background-size: cover;
padding-bottom: 50%;
padding-bottom: 20%;
}
table.foul {
background-color: rgb(202, 198, 198);
font-size: 20px;
}
div.foulTable {
padding-left: 380px;
}
td.leftFoul {
padding-right: 76px;
}
td.rightFoul {
padding-left: 76px;
}
div.table {
padding-top: 23%;
padding-left: 25%;
font-size: 30px;
}
table {
border:5px solid rgb(202, 198, 198);
}
td.city {
background-color: #085e26;
color: #ffffff;
padding-left: 5px;
padding-right: 5px;
padding-top: 5px;
padding-bottom: 5px;
}
td.team {
background-color: #004880;
color: #ffffff;
padding-left: 5px;
padding-right: 5px;
padding-top: 5px;
padding-bottom: 5px;
}
td.team2 {
background-color: #800000;
color: #ffffff;
padding-left: 5px;
padding-right: 5px;
padding-top: 5px;
padding-bottom: 5px;
}
td.score {
background-color: #ffffff;
color: #000000;
padding-left: 5px;
padding-right: 5px;
padding-top: 5px;
padding-bottom: 5px;
}
td.quarter {
background-color: #343333;
color: #eae12e;
padding-left: 5px;
padding-right: 15px;
padding-top: 5px;
padding-bottom: 5px;
}
td.time {
background-color: #343333;
color: #f3ecec;
padding-left: 5px;
padding-right: 5px;
padding-top: 5px;
padding-bottom: 5px;
}
/* NAVBAR */
nav.navbar {
background: -webkit-linear-gradient(to right, #004880, #b00606);
background: linear-gradient(to right, #004880, #b00606);
color: #ffffff;
border: 0px;
padding-top: 5px;
padding-bottom: 10px;
}
.jumbotron {
margin-bottom: 0;
padding: 0.5%;
}
footer {
background-color: #f2f2f2;
padding: 15px;
}
</style>
</html>