Spaces:
Running
Running
TenPoisk
commited on
Commit
Β·
4ea84c9
1
Parent(s):
4656ce2
Update index.html
Browse files- index.html +105 -16
index.html
CHANGED
@@ -1,19 +1,108 @@
|
|
1 |
<!DOCTYPE html>
|
2 |
<html>
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
</html>
|
|
|
1 |
<!DOCTYPE html>
|
2 |
<html>
|
3 |
+
<head>
|
4 |
+
<title>Length Converter</title>
|
5 |
+
</head>
|
6 |
+
<body>
|
7 |
+
<h1>π’ Length Converter</h1>
|
8 |
+
|
9 |
+
<label for="input">Meaning:</label>
|
10 |
+
<input type="number" id="input" placeholder="Enter value">
|
11 |
+
<p></p>
|
12 |
+
<label for="from">π£ From:</label>
|
13 |
+
<select id="from">
|
14 |
+
<option value="meter">Meters</option>
|
15 |
+
<option value="kilometer">Kilometers</option>
|
16 |
+
<option value="millimeter">Millimeters</option></option>
|
17 |
+
<option value="decimeter">Decimeters</option>
|
18 |
+
<option value="centimeter">Centimeters</option>
|
19 |
+
</select>
|
20 |
+
|
21 |
+
<label for="to">π’ To:</label>
|
22 |
+
<select id="to">
|
23 |
+
<option value="meter">Meters</option>
|
24 |
+
<option value="kilometer">Kilometers</option>
|
25 |
+
<option value="millimeter">Millimeters</option>
|
26 |
+
<option value="decimeter">Decimeters</option>
|
27 |
+
<option value="centimeter">Centimeters</option>
|
28 |
+
</select>
|
29 |
+
<p></p>
|
30 |
+
<button onclick="convert()">β»οΈ Convert</button>
|
31 |
+
|
32 |
+
<p id="result"></p>
|
33 |
+
|
34 |
+
<script>
|
35 |
+
function convert() {
|
36 |
+
var input = document.getElementById("input").value;
|
37 |
+
var from = document.getElementById("from").value;
|
38 |
+
var to = document.getElementById("to").value;
|
39 |
+
|
40 |
+
var result;
|
41 |
+
|
42 |
+
if (from === "meter") {
|
43 |
+
if (to === "meter") {
|
44 |
+
result = input;
|
45 |
+
} else if (to === "kilometer") {
|
46 |
+
result = input / 1000;
|
47 |
+
} else if (to === "millimeter") {
|
48 |
+
result = input * 1000;
|
49 |
+
} else if (to === "decimeter") {
|
50 |
+
result = input * 10;
|
51 |
+
} else if (to === "centimeter") {
|
52 |
+
result = input * 100;
|
53 |
+
}
|
54 |
+
} else if (from === "kilometer") {
|
55 |
+
if (to === "meter") {
|
56 |
+
result = input * 1000;
|
57 |
+
} else if (to === "kilometer") {
|
58 |
+
result = input;
|
59 |
+
} else if (to === "millimeter") {
|
60 |
+
result = input * 1000000;
|
61 |
+
} else if (to === "decimeter") {
|
62 |
+
result = input * 10000;
|
63 |
+
} else if (to === "centimeter") {
|
64 |
+
result = input * 100000;
|
65 |
+
}
|
66 |
+
} else if (from === "millimeter") {
|
67 |
+
if (to === "meter") {
|
68 |
+
result = input / 1000;
|
69 |
+
} else if (to === "kilometer") {
|
70 |
+
result = input / 1000000;
|
71 |
+
} else if (to === "millimeter") {
|
72 |
+
result = input;
|
73 |
+
} else if (to === "decimeter") {
|
74 |
+
result = input / 100;
|
75 |
+
} else if (to === "centimeter") {
|
76 |
+
result = input / 10;
|
77 |
+
}
|
78 |
+
} else if (from === "decimeter") {
|
79 |
+
if (to === "meter") {
|
80 |
+
result = input / 10;
|
81 |
+
} else if (to === "kilometer") {
|
82 |
+
result = input / 10000;
|
83 |
+
} else if (to === "millimeter") {
|
84 |
+
result = input * 100;
|
85 |
+
} else if (to === "decimeter") {
|
86 |
+
result = input;
|
87 |
+
} else if (to === "centimeter") {
|
88 |
+
result = input * 10;
|
89 |
+
}
|
90 |
+
} else if (from === "centimeter") {
|
91 |
+
if (to === "meter") {
|
92 |
+
result = input / 100;
|
93 |
+
} else if (to === "kilometer") {
|
94 |
+
result = input / 100000;
|
95 |
+
} else if (to === "millimeter") {
|
96 |
+
result = input * 10;
|
97 |
+
} else if (to === "decimeter") {
|
98 |
+
result = input / 10;
|
99 |
+
} else if (to === "centimeter") {
|
100 |
+
result = input;
|
101 |
+
}
|
102 |
+
}
|
103 |
+
|
104 |
+
document.getElementById("result").innerHTML = result;
|
105 |
+
}
|
106 |
+
</script>
|
107 |
+
</body>
|
108 |
</html>
|