-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsoma.html
More file actions
26 lines (26 loc) · 848 Bytes
/
soma.html
File metadata and controls
26 lines (26 loc) · 848 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Somando Numeros </title>
</head>
<body>
<h1>Somando 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 aqui</div>
<script>
function somar(){
var tn1 = window.document.getElementById('txtn1')
var tn2=window.document.querySelector('input#txtn2')
var res=window.document.getElementById('res')
var n1=Number(tn1.value)
var n2=Number(tn2.value)
var s = n1+n2
res.innerHTML=`A soma entre ${n1} e ${n2} sera ${s}`
}
</script>
</body>
</html>