Using Visual Studio please complete the following HTML page
Using Visual Studio, please complete the following HTML page:
On this form, you will calculate the payment on a loan. JavaScript does not have a PMT function like VB or Excel. Thus, you will have to use the formula to get the answer. If you don\'t remember the formula to calculate a payment, visit http://www.financeformulas.net/Loan_Payment_Formula.html
So that you can check your work, the payment on a $100,000 loan for 10 years at 6% interest is $1,110.21.
Inputs: Initial Loan Amount, Number of Periods (Years), Interest Rate (Years)
Output: Payment amount
Note, when calculating the payment, the user enters the input values in years. However, the payment should be calculated using values expressed in months. Thus, you must multiply the number of periods by 12 to express the value in months. You need to divide the interest rate by 12 to express the annual interest rate as a monthly interest rate.
Solution
<!DOCTYPE html>
<html>
<head>
<script>
function LoanAmount() {
var amount = document.forms[\"Calculate\"][\"ila\"].value;
var period = document.forms[\"Calculate\"][\"nop\"].value;
var rate = document.forms[\"Calculate\"][\"ir\"].value;
if (amount == null || amount == \"\" || period == null || period == \"\" || rate == null || rate == \"\") {
alert(\"Please Enter the number\");
return false;
}
else{
var r = rate/12;
var n = period*12;
var pv = amount*r;
var divisor = (Math.pow((1+r) ,n) - 1) / Math.pow((1+r) ,n) ;
var ans = r*pv/divisor;
}
document.getElementById(\"answer\").innerHTML = ans;
return true;
}
</script>
</head>
<body>
<form name=\"Calculate\"
onsubmit=\"LoanAmount(); return false;\">
Initial Loan Amount:<br>
<input type=\"text\" name=\"ila\" >
<br>
Number of Periods:<br>
<input type=\"text\" name=\"nop\">
<br>
Interest Rate:<br>
<input type=\"text\" name=\"ir\" >
<br><br>
<p id=\"answer\"></p>
<input type=\"submit\" value=\"Submit\">
</form>
</body>
</html>

