-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnode_b27958ed732d9.tmp
41 lines (39 loc) · 1.15 KB
/
node_b27958ed732d9.tmp
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
<!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">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<title>Somar Numeros</title>
<style>
body{
font: normal 18pt arial;
}
input{
font: normal 18pt arial;
width: 100px;
}
div#res {
padding-top: 20px;
}
</style>
</head>
<body>
<h1>Somar Valores</h1>
<input type="number" name="txtn1" id="txtn1">
<input type="number" name="txtn2" id="txtn2">
<input type="button" value="Somar" onclick="somar()">
<div id="res">Resultado</div>
<script>
function somar(){
var tn1 = window.document.getElementById('txtn1')
var tn2 = window.document.querySelector('input#txtn2')
var n1 = Number(tn1.value)
var n2 = Number(tn2.value)
var s = n1 + n2
res.innerHTML = `A soma ${n1} e ${n2} é igual a <strong> ${s} </strong>`
}
</script>
</body>
</html>