Create an HTML document with JavaScript code that
a) Has three textboxes and a button.
b) The details to be accepted using textboxes are principal, rate of interest, and duration in years.
c) When user clicks the Ok button a message box appears showing the simple interest of principal amount.
Solution:
<html>
<head>
<title>interest</title>
<script>
function cal()
{
p =
document.getElementById("p").value;
r =
document.getElementById("r").value;
n =
document.getElementById("t").value;
alert("Simple interest of
principal amount = " + (p*n*r/100));
}
</script>
</head>
<body>
<h1>Simple Interest
Calculator</h1>
Amount: <input
id="p"><br>
Rate Of Interest: <input
id="r"><br>
Time (in Years) : <input
id="t"><br>
<button onclick="cal()">OK</button>
</body>
</html>
0 Comments
Hey, What do you think about this post