forked from MateusAugustoFerreira/exercicio-js-turma-tarde
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsoma.html
33 lines (28 loc) · 897 Bytes
/
soma.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
<!DOCTYPE html>
<html lang="pt-br">
<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>exercicios</title>
</head>
<body>
<div>
<input id="a" type="number" placeholder="digite um numero">
<input id="b" type="number" placeholder="digite um numero">
<input id="soma" type="button" name="somar" onclick="clicar()">
</div>
<div id="resp">resposta:</div>
</body>
</html>
<script>
function clicar() {
var resp = document.getElementById("resp")
var num1 = document.getElementById('a')
var num2 = document.getElementById('b')
var input1 = Number(num1.value)
var input2 = Number(num2.value)
resp = input1 + input2;
document.getElementById('resp').innerText = resp
}
</script>