-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjs4.html
More file actions
35 lines (29 loc) · 793 Bytes
/
js4.html
File metadata and controls
35 lines (29 loc) · 793 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
28
29
30
31
32
33
34
35
<!DOCTYPE html>
<html lang="en">
<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>soal4 Menghitung jumlah dua Bilangan</title>
</head>
<body>
<input type="number" id="angka1">
<br>
<h1>+</h1>
<br>
<input type="number" id="angka2" onchange="tambah()">
<br>
<h1>=</h1>
<br>
<h1 id="hasil"></h1>
<script>
function tambah() {
let a1, a2, hsl
a1 = document.getElementById("angka1").value
a2 = document.getElementById("angka2").value
hsl = parseInt(a1) + parseInt(a2)
document.getElementById("hasil").innerHTML = hsl
}
</script>
</body>
</html>