-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
69 lines (66 loc) · 2.15 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
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<style>
body{
margin-top: 70px;
background: #9999ff;
color: #0000cc
}
</style>
<title>Convertidor de Peso</title>
</head>
<body>
<div class ="container">
<div class ="row">
<div class ="col-md-6 offset-md-3">
<h1 class="display-4 text center"> Convertidor de Peso </h1>
<form>
<div class ="form-group">
<input
id= "lbsInput"
type="number"
class ="form-control form-control-lg"
placeholder="Libras...">
</div>
</form>
<div id= "output">
<div class=" card text-primary mb-1">
<div class="card-block">
<h4>Gramos:</h4>
<div id="gramsOutput">
</div>
</div>
</div>
<div class=" card text-success mb-1">
<div class="card-block">
<h4>Kilogramos:</h4>
<div id="kilogramsOutput">
</div>
</div>
</div>
<div class=" card text-danger mb-1">
<div class="card-block">
<h4>Onzas:</h4>
<div id="onzasOutput">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
document.getElementById('output').style.visibility = 'hidden';
document.getElementById("lbsInput").addEventListener('input', function(e){
document.getElementById('output').style.visibility = 'visible';
let lbs = e.target.value;
document.getElementById("gramsOutput").innerHTML = lbs/ 0.0022046;
document.getElementById("kilogramsOutput").innerHTML = lbs/ 2.2046;
document.getElementById("onzasOutput").innerHTML = lbs*16;
});
</script>
</body>
</html>