-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.html
52 lines (50 loc) · 1.43 KB
/
test.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>
<head>
<title>Conversor de Área</title>
<script>
function convert() {
var from = document.getElementById("from").value;
var to = document.getElementById("to").value;
var value = parseFloat(document.getElementById("value").value);
if (from == "sqm" && to == "sqft") {
value = value * 10.764;
} else if (from == "sqft" && to == "sqm") {
value = value / 10.764;
} else if (from == "sqm" && to == "sqin") {
value = value * 1550;
} else if (from == "sqin" && to == "sqm") {
value = value / 1550;
} else if (from == "sqft" && to == "sqin") {
value = value * 144;
} else if (from == "sqin" && to == "sqft") {
value = value / 144;
}
document.getElementById("result").value = value.toFixed(2);
}
</script>
</head>
<body>
<h1>Conversor de Área</h1>
<label>De:</label>
<select id="from">
<option value="sqm">Metro Quadrado (m²)</option>
<option value="sqft">Pé Quadrado (ft²)</option>
<option value="sqin">Polegada Quadrada (in²)</option>
</select>
<br>
<label>Para:</label>
<select id="to">
<option value="sqm">Metro Quadrado (m²)</option>
<option value="sqft">Pé Quadrado (ft²)</option>
<option value="sqin">Polegada Quadrada (in²)</option>
</select>
<br>
<label>Valor:</label>
<input type="number" id="value">
<button onclick="convert()">Converter</button>
<br>
<label>Resultado:</label>
<input type="number" id="result" disabled>
</body>
</html>