I'm just beginning to learn javascript, so this is probably something very easy that I am overlooking.
<!DOCTYPE html>
<html>
<head>
<script>
function calculatePayment()
{
//formula: M = P * ( J / (1 - (1 + J) ** -N))
Monthlypayment.value=balance.value;
}
</script>
</head>
<body>
<form onsubmit="return false" name="MortgageCalculator" oninput="calculatePayment()">
<fieldset>
<legend>Loan Basics</legend>
<div>
<label for="balance">Beggining Balance: </label><input type="number" name="balance" min="10000" max="5000000" step="10000" size="7" value="150000" required>
</div>
<div>
<label for="rate">Interest Rate (%): </label><input type="number" name="rate" min="0" max="99" step=".25" size="4" value="4.5" required>
</div>
<div>
<label for="term">Term (months): </lable><input type="number" name="term" min="6" max="360" step="1" size="3" value="360" required>
</div>
<div>
<input type="submit" value="Submit" onclick="calculatePayment()">
</div>
</fieldset>
<div class="calculations">
<label for="MonthlyPayment">Monthly Payment: </label><output name="MonthlyPayment" for="balance rate term" form="MortgageCalculator" onforminput="Monthlypayment.value=balance.value"></output>
</div>
</form>
</body>
</html>
It seems to go to the function correctly, but I can't actually change the output to display anything.