-
Notifications
You must be signed in to change notification settings - Fork 0
/
sample.html
50 lines (41 loc) · 1.73 KB
/
sample.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
<!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>Document</title>
<script>
const form = document.getElementById("form");
function calculate() {
// var outstanding = document.getElementById('outstanding').value;
// var outstanding = +outstanding;
// var amount = document.getElementById("amount").value;
// var amount = +amount;
// var balance = document.getElementById("balane");
// var balance = amount * outstanding;
// document.getElementById('balance').value = balance;
// balance.innerText = `${balance}`;
// console.log(balance);
var outstanding = document.form.outstanding.value;
var outstanding = +outstanding;
var amount = document.form.amount.value;
var amount = +amount;
var balance = document.getElementById("balane");
var balance = amount * outstanding;
document.getElementById('balance').value = balance;
console.log('object :>> ', balance);
}
// form.onsubmit = calculate();
</script>
</head>
<body>
<form action="" method="post" id="form" name="form">
<input type="number" id="outstanding" name="outstanding" value=""> <br>
<input type="number" id="amount" name="amount" value=""> <br>
<input type="button" id="cal" name="cal" value="calculate" onclick="calculate()"> <br>
<input type="number" id="balance" name="balance" value="">
<!-- <p id="balance"></p> -->
</form>
</body>
</html>