-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjava2.html
More file actions
34 lines (29 loc) · 1.02 KB
/
Copy pathjava2.html
File metadata and controls
34 lines (29 loc) · 1.02 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Multiplication</title>
</head>
<body>
<!-- <input fields for the numbers to be added> -->
<h1>Area</h1>
<label for="area1">Area 1:</label>
<input type="number" id="area1" name="area1"><br><br>
<label for="area2">Area 2:</label>
<input type="number" id="area2" name="area2"><br><br>
<button onclick="multiply()">MULTIPLY</button>
<!-- <output field for the sum></output> -->
<p id="result"></p>
<script>
function multiply(){
//getting values from the input tag, and we are making sure it's a num that can be added
let area1=parseFloat(document.getElementById("area1").value);
let area2=parseFloat(document.getElementById("area2").value);
let sum=1/2*area1*area2;
//display our result
document.getElementById("result").innerText="The sum is: "+sum;
}
</script>
</body>
</html>