generated from microverseinc/readme-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
52 lines (46 loc) · 1.47 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Calculator</title>
</head>
<body>
<h1>Measure your weight in others planets</h1>
<h2>This is your wight =</h2>
<form>
<input type="number" name="number" id="weight">Cual es tu peso?
<input type="number" name="planet" id="planet">Elige tu planeta <br> es marte, 2 es jupiter
<button type="button" onclick="getData()">See your weight</button>
</form>
<script>
let getData = () =>{
let usuario = document.getElementById('weight').value;
let planeta = document.getElementById('planet').value;
console.log(usuario, planeta);
let peso = usuario;
let g_tierra = 9.8;
let g_marte = 3.7;
let g_jupiter = 24.8;
let peso_final;
if (planeta == 1)
{
peso_final = peso * g_marte / g_tierra;
document.write("Your weigth on Mars is <strong>" + peso_final + " kilos</strong>");
}
else if(planeta == 2)
{
peso_final = peso * g_jupiter / g_tierra;
document.write("Your weigth on Jupiter is <strong>" + peso_final + " kilos</strong>");
}
else
{
peso_final = 1000000;
document.write("Your weigth on Krypton is <strong>" + peso_final + " kilos</strong>");
}
}
getData();
</script>
</body>
</html>