-
Notifications
You must be signed in to change notification settings - Fork 4
/
Weight.html
76 lines (70 loc) · 1.94 KB
/
Weight.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
<!DOCTYPE html>
<html>
<head>
<title>Weight Converter</title>
<style>
span {
color: white;
font-family: "Franklin Gothic Medium", "Arial Narrow", Arial, sans-serif;
}
h1 {
text-align: center;
}
.myConverter {
border: 5px outset rgba(255, 0, 0, 0);
background-color: rgba(98, 98, 137, 0.9);
border-radius: 20px;
text-align: center;
position: relative;
margin-left: auto;
margin-right: auto;
width: 30%;
opacity: 30;
min-height: 300px;
word-spacing: 10px;
padding-top: 100px;
margin-top: 80px;
}
.box {
display: flex;
justify-content: space-evenly;
}
.main {
margin-bottom: 50px;
}
</style>
</head>
<body style="background-image: url('A7301919.jpg')">
<h1 style="color: rgb(3, 3, 0)">WEIGHT CONVERTER</h1>
<div class="myConverter">
<p class="main">
<label>KILOGRAM </label>
<input
id="kilogram"
type="number"
placeholder="kilograms"
oninput="kiloweightConvert(this.value)"
onchange="kiloweightConvert(this.value)"
/>
</p>
<!-- output field-->
<div class="box">
<p>POUND: <span id="Pounds"></span></p>
<p>OUNCE: <span id="Ounces"></span></p>
</div>
<div class="box">
<p>GRAM: <span id="Grams"></span></p>
<p>STONE: <span id="Stones"></span></p>
</div>
</div>
<script>
//function that evaluates the weight and return result
function kiloweightConvert(value) {
document.getElementById("Pounds").innerHTML = value * 2.2046;
document.getElementById("Ounces").innerHTML = value * 35.274;
document.getElementById("Grams").innerHTML = value * 1000;
document.getElementById("Stones").innerHTML = value * 0.1574;
}
</script>
</body>
</html>