forked from ArjunVaskale/html_program
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimpleinterest.html
More file actions
50 lines (49 loc) · 1.57 KB
/
simpleinterest.html
File metadata and controls
50 lines (49 loc) · 1.57 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<html>
<head>
<title>Simple Interest Calculation</title>
</head>
<body>
<form id="myForm">
<table border = "0" width = 300px>
<tr>
<td>
Amount:
</td>
<td>
<input type="text" id="p">
</td>
</tr>
<tr>
<td>
Rate:
</td>
<td>
<input type="text" id="r">
</td>
</tr>
<tr>
<td>
No. of Years:
</td>
<td>
<input type="text" id="t">
</td>
</tr>
</table>
<button onclick="document.getElementById('myForm').value = ''">Clear</button>
</form>
<p>
<button onClick="calculate()">Calculate</button>
</p>
<p id="result"></p>
</body>
<script>
function calculate(){
p = document.getElementById("p").value; //check this one and corrent it
r = document.getElementById("r").value;
t = document.getElementById("t").value;
result = document.getElementById("result");
result.innerHTML = "Amount is "+ p +"<br>Rate is "+ r +"<br>Time is "+ t +"<br>The interest is " + (p*r*t/100);
}
</script>
</html>