-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
27 lines (21 loc) · 872 Bytes
/
script.js
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
function compute() {
p = parseInt(document.getElementById("principal").value);
r = parseFloat(document.getElementById("intrate").value);
t = parseInt(document.getElementById("years").value);
si = (p * t * r / 100);
var n = 2020 + t;
document.getElementById('rprincipal').innerHTML = "deposit <mark>" + p + ".</mark>";
document.getElementById('rintrate').innerHTML = "at an interest of <mark> " + r + "%" + ".</mark>";
document.getElementById('rinterest').innerHTML = "You will receive <mark> " + si + ".</mark>";
document.getElementById( 'rdate').innerHTML = "in the year <mark>" + n + ".</mark>";
}
function update_rate(rate) {
document.getElementById("percent").innerHTML = rate.value + " %";
}
function validatePrincipal(that){
if (that.value < 1 ){
alert("Enter a Positive number");
that.value = " ";
that.focus();
}
}