Repository navigation
Expand file tree
/
Copy pathwaterIntake.html
More file actions
142 lines (127 loc) · 2.6 KB
/
Copy pathwaterIntake.html
File metadata and controls
142 lines (127 loc) · 2.6 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
130
131
132
133
134
135
136
137
138
139
140
141
142
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
tr:nth-child(2),
tr:nth-child(3),
tr:nth-child(4),
tr:nth-child(5),
tr:nth-child(6),
tr:nth-child(7),
tr:nth-child(13),
tr:nth-child(14),
tr:nth-child(15)
{
background-color: rgb(186, 225, 248);
color:black;
}
tr:nth-child(8),
tr:nth-child(9),
tr:nth-child(10),
tr:nth-child(11),
tr:nth-child(12),
tr:nth-child(16)
{
background-color: rgb(248, 247, 186);
color:black;
}
table {
color: #333;
/* Lighten up font color */
font-family: Helvetica, Arial, sans-serif;
/* Nicer font */
width: 640px;
border-collapse: collapse;
border-spacing: 0;
}
td,
th {
border: 1px solid #CCC;
height: 30px;
}
/* Make cells a bit taller */
th {
background: #F3F3F3;
/* Light grey background */
font-weight: bold;
/* Make sure they're bold */
}
td {
/* Lighter grey background */
text-align: left;
/* Center our text */
padding-left: 1rem;
}
body {
padding: 1rem;
}
</style>
<h2>How many containers needed to drink a gallon of water</h2>
<table>
<tr>
<th>
Container
</th>
<th>
Quantity Needed For Gallon
</th>
</tr>
<tr>
<td>
Liter
</td>
<td>
3.78
</td>
</tr>
<tr>
<td>
Clean Bottles
</td>
<td>
5.12
</td>
</tr>
</table>
<script>
function calculateWater() {
const liters = document.getElementById('liters').value;
const cleanBottles = document.getElementById('cleanBottles').value;
const gallonsDrank = (liters * .26) + (cleanBottles * .19);
const gallonsDrankElement = document.getElementById("gallonsDrank")
gallonsDrankElement.innerHTML = gallonsDrank
}
</script>
</br></br>
<table>
<tr>
<td>
Quantity
</td>
<td>
Amount Drank
</td>
</tr>
<tr>
<td>
Liters:
</td>
<td>
<input id="liters"></input>
</td>
</tr>
<tr>
<td>
Clean Bottles:
</td>
<td>
<input id="cleanBottles"></input>
</td>
</tr>
<tr>
<td>
Gallons Drank: <span id="gallonsDrank">0</span>
</td>
<td>
<input type="submit" onclick="calculateWater();">
</td>
</tr>
</table>