forked from Popesites/kilometersMilesConversion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
303 lines (284 loc) · 9.31 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
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
295
296
297
298
299
300
301
302
303
<!doctype html>
<html>
<head>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-74303719-3', 'auto');
ga('send', 'pageview');
</script>
<link rel='shortcut icon' href='favicon.ico' type='image/x-icon'/ >
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<title>Convert Kilometers to Miles Convert Miles to Kilometers</title>
<link rel="stylesheet" href="stylesheets/styles.css">
<link rel="stylesheet" href="stylesheets/github-dark.css">
<script src="javascripts/scale.fix.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<script>
function computeConversionK() {
var methodTwo = document.getElementById("methodTwo").innerHTML;
var distanceTwo = document.getElementById("distanceTwo").value;
if (methodTwo == "Mile")
{
methodTwo = 1.60934;
}
else {
methodTwo = 0.621371;
var resultTwo = (methodTwo * distanceTwo);
var x = resultTwo.toFixed(2);
if (distanceTwo == 1) {
document.getElementById('paymentTwo').innerHTML = distanceTwo + " kilometer is equal to " + x + " miles.";
}
else if (distanceTwo < 0) {
document.getElementById('paymentTwo').innerHTML = "Invalid input, try again.";
}
else {
document.getElementById('paymentTwo').innerHTML = distanceTwo + " kilometers are equal to " + x + " miles.";
}
}
}
function computeConversion() {
var method = document.getElementById("method").innerHTML;
var distance = document.getElementById("distance").value;
if (method == "Kilometer")
{method = 0.621371;}
else {
method = 1.60934;
var result = (method * distance);
var n = result.toFixed(2);
if (distance == 1) {
document.getElementById('payment').innerHTML = distance + " mile is equal to " + n + " kilometers.";
}
else if (distance < 0) {
document.getElementById('payment').innerHTML = "Invalid input, try again.";
}
else {
document.getElementById('payment').innerHTML = distance + " miles are equal to " + n + " kilometers.";
}
}
}
</script>
</head>
<body>
<div class="wrapper">
<header>
<h1 style = "text-align: left;">Kilometers Miles Conversion</h1>
<p>Converts kilometers to miles & vice versa.</p>
<p class="view"><a href="https://github.com/Popesites/kilometersMilesConversion">View the Project on GitHub <small>Popesites/kilometersMilesConversion</small></a></p>
<ul>
<li><a href="https://github.com/Popesites/kilometersMilesConversion">View On <strong>GitHub</strong></a></li>
</ul>
</header>
<section>
<div id = "WelcomeMessage">
<h3>
<a id="welcome-to-github-pages" class="anchor" href="#welcome-to-github-pages" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Convert Kilometers to Miles and Miles to Kilometers.</h3>
<p>Convert kilometers to miles (km to m) or convert miles to kilometers (m to km). Enter the distance you want to convert and you'll get the result.</p>
</div>
<hr>
<div class="button-container" style ="display:inline-block;">
<div style ="display:inline-block;">
<p>
<label for="method">
<span>Miles to Kilometers:</span>
<select id="method" name="usercard" onchange="computeConversion()">
<option value="miles">Miles</option>
</select>
</label>
</p>
</div>
<div style ="display:inline-block;">
<label for="Distance">Distance:</label>
<input type="number" id="distance" name="user_distance" onchange="computeConversion()" />
</div>
</div>
<h3 id ="payment"></h3>
<div class="button-container" style ="display:inline-block;">
<div style ="display:inline-block;">
<p>
<label for="methodTwo">
<span>Kilometers to Miles:</span>
<select id="methodTwo" name="usercardTwo" onchange="computeConversionK()">
<option value="Kilometers">Kilometers</option>
</select>
</label>
</p>
</div>
<div style ="display:inline-block;">
<label for="distanceTwo">Distance:</label>
<input type="numberTwo" id="distanceTwo" name="user_distanceTwo" onchange="computeConversionK()" />
</div>
</div>
<h3 id = "paymentTwo"></h3>
<hr>
<div style = "display:inline-block">
<h4 style = "display:inline-block">Kilometer:</h4>
<p style = "display:inline-block"> A metric unit of measurement equal to 1,000 meters (approx. 0.62 miles).</p>
</div>
<div style = "display:inline-block">
<h4 style = "display:inline-block">Mile:</h4>
<p style = "display:inline-block"> A unit of linear measure equal to 5,280 feet, or 1,760 yards (approx. 1.609 kilometers).</p>
</div>
<hr>
<p>Advertisement:</p>
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- ads -->
<ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-7361984541839986"
data-ad-slot="4915613554"
data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
<hr>
<h4>How to convert kilometers to miles in your head:</h4>
<p style = "text-align: left;"><strong>Miles to Kilometers:</strong> Essentially, you're adding 60%. While that's kinda hard to do in your head, if you break it down into 50% + 10%, it makes it much easier.
Lets say you're trying to convert 50 Miles into kilometers. You're going to add 50 + 25 + 5. (100% + 50% + 10%). That equals 80 km. It's precise conversion is 80.4672. So that's not bad for a quick conversion.
Let's do another. 70 Miles. 70 + 35 + 7 = 112 km. It's exact conversion is 112.654. Again, not 100% accurate, but close enough to get you where you need to go.</p>
<p style = "text-align: left;"><strong>Kilometers to Miles</strong>: Essentially the opposite, you're subtracting 40%. Again, it's much easier if you break it down. Subtract 50%, then add 10% back.
Here it is in practice, I'll do 120 km. 120 - 60 + 12 (100% - 50% + 10%) It comes out to 72. It's exact measurement is 74.5645. Not quite as accurate as miles - kilometers, but it still gives you a great estimate.
One more. 50 km. 50 - 25 + 5 = 30. It's exact conversion is 31.0686. Again, not perfect, but it'll get you where you need to go.</p>
<hr>
<p>Advertisement:</p>
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- ads -->
<ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-7361984541839986"
data-ad-slot="4915613554"
data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
<hr>
<h4>Kilometers to Miles Table:</h4>
<table class="ntable">
<thead>
<tr>
<th>Kilometers (km)</th>
<th>Miles (mi)</th>
</tr>
</thead>
<tbody>
<tr>
<td>0.01 km</td>
<td>0.0062 mi</td>
</tr>
<tr>
<td>0.1 km</td>
<td>0.0621 mi</td>
</tr>
<tr>
<td>1 km</td>
<td>0.6214 mi</td>
</tr>
<tr>
<td>2 km</td>
<td>1.2427 mi</td>
</tr>
<tr>
<td>3 km</td>
<td>1.8641 mi</td>
</tr>
<tr>
<td>4 km</td>
<td>2.4855 mi</td>
</tr>
<tr>
<td>5 km</td>
<td>3.1069 mi</td>
</tr>
<tr>
<td>6 km</td>
<td>3.7282 mi</td>
</tr>
<tr>
<td>7 km</td>
<td>4.3496 mi</td>
</tr>
<tr>
<td>8 km</td>
<td>4.9710 mi</td>
</tr>
<tr>
<td>9 km</td>
<td>5.5923 mi</td>
</tr>
<tr>
<td>10 km</td>
<td>6.2137 mi</td>
</tr>
<tr>
<td>20 km</td>
<td>12.4274 mi</td>
</tr>
<tr>
<td>30 km</td>
<td>18.6411 mi</td>
</tr>
<tr>
<td>40 km</td>
<td>24.8548 mi</td>
</tr>
<tr>
<td>50 km</td>
<td>31.0686 mi</td>
</tr>
<tr>
<td>60 km</td>
<td>37.2823 mi</td>
</tr>
<tr>
<td>70 km</td>
<td>43.4960 mi</td>
</tr>
<tr>
<td>80 km</td>
<td>49.7097 mi</td>
</tr>
<tr>
<td>90 km</td>
<td>55.9234 mi</td>
</tr>
<tr>
<td>100 km</td>
<td>62.1371 mi</td>
</tr>
</tbody>
</table>
<hr>
<p>Advertisement:</p>
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- ads -->
<ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-7361984541839986"
data-ad-slot="4915613554"
data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
<hr>
<a href="https://www.facebook.com/sharer/sharer.php?u=https%3A//github.com/Popesites/kilometersMilesConversion">Share on Facebook</a>
</section>
</div>
<footer>
<p>Project maintained by <a href="https://github.com/Popesites">Popesites</a></p>
<p>Miles to Kilometers © 2016 Conner Pope</p>
</footer>
<!--[if !IE]><script>fixScale(document);</script><![endif]-->
</body>
</html>