-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
63 lines (57 loc) · 1.69 KB
/
index.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Aplikasi Kalkulator Matematika</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div class="container">
<div class="title">
<h1>Kalkulator Segi Empat</h1>
<p>Dibuat dengan HTML, CSS , dan Javascript</p>
</div>
<hr>
<div class="content">
<div class="left-content">
<img src="SegiEmpat.png">
</div>
<div class="right-content">
<h2>Menghitung Luas dan Keliling</h2>
<br>
<label>Panjang:</label>
<input id="p" type="number" name="panjang" placeholder="Masukkan Panjang">
<br>
<label>Lebar:</label>
<input id="l" type="number" name="lebar" placeholder="Masukkan Lebar">
<br>
<button onclick="hitungluas()">Hitung Luas :</button>
<span id="luas"></span>
<br>
<button onclick="hitungkeliling()">Hitung Keliling :</button>
<span id="keliling"></span>
</div>
</div>
</div>
<footer>
<p>@copyright Kalk App By Fidel X3</p>
</footer>
<script type="text/javascript">
function hitungluas () {
let panjang = document.getElementById('p').value;
let lebar =document.getElementById('l').value;
let luas = panjang * lebar ;
document.getElementById('luas').innerHTML =` adalah ${luas}
cm<sup>2</sup>`;
}
function hitungkeliling () {
let panjang = document.getElementById('p').value;
let lebar =document.getElementById('l').value;
let keliling = 2*panjang + 2*lebar;
document.getElementById('keliling').innerHTML = ` adalah ${keliling}
cm<sup>2</sup>`;
}
</script>
</body>
</html>