-
Notifications
You must be signed in to change notification settings - Fork 191
Expand file tree
/
Copy pathFormulaConditional.js
More file actions
27 lines (22 loc) · 619 Bytes
/
FormulaConditional.js
File metadata and controls
27 lines (22 loc) · 619 Bytes
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
<!DOCTYPE html>
<html>
<title>Conversor</title>
<body>
<h2>Conversor</h2>
<p>Conversor:</p>
<p>
<label>valor</label>
<input id = "inputValor" type = "number" placeholder = "valor" oninput = "Conversor(this.value)" onchange = "Conversor(this.value)">
</p>
<p>Resultado: <span id = "outputValor"></span></p>
<script>
function Conversor(valNum) {
var gre = valNum >= 200 ? 4 : 2;
var add = valNum >= 200 ? 4 : 0;
var add2 = valNum >= 400 ? 4 : 0;
document.getElementById("outputValor").innerHTML = valNum * gre + add + add2;
}
</script>
</body>
</html>
//https://pt.stackoverflow.com/q/387177/101