What I am looking to do is create a group of variables that work off each other and I'm not sure how to do this. I'm looking to create a webpage that compounds interest quarterly and am not sure how I would go about implementing the code and variables.
I believe I have the page lain out but am not sure how to go about making the variables change with each quarter. So I can get quarter one complete, but have no idea how to write the formulas or code that work off the first quarter to complete the second quarter. Here is my haphazard attempt and what I have done so far. Any help is greatly appreciated.
I believe I have the page lain out but am not sure how to go about making the variables change with each quarter. So I can get quarter one complete, but have no idea how to write the formulas or code that work off the first quarter to complete the second quarter. Here is my haphazard attempt and what I have done so far. Any help is greatly appreciated.
Code:
<!doctype html>
<!-- attempt3.html some guy -->
<!-- Web page that calculates the calculates interest quarterly -->
<!-- =================================================== -->
<html>
<head>
<title> quarterly interest </title>
</head>
<body>
<h2>Quarterly Interest Calculator</h2>
<p>
<table border="1">
<tr>
<th>Beginning Balance:</th> <th>$<input type="text" id="amountBox" size=10 value="10000"></th>
<br>
</tr>
<tr>
<th>Interest Rate:</th> <th><input type="text" id="interestBox" size=10 value="3.5">%</th>
</p>
<input type="button" value="Click for Calculation"
onclick="Q1 = parseFloat(document.getElementById('amountBox').value);
interest = Q1 * ((document.getElementById('interestBox').value)/100);
document.getElementById('outputDiv').innerHTML=
'Total interest Earned: ' + interest;">
<script>
document.getElementById('outputDiv')
<br>
<table border="1">
<tr>
<th>Quarter</th>
<th>Principal</th>
<th>Interest Earned</th>
</tr>
<tr>
<td>1</td>
<td>$</td>
<td>$ </td>
</tr>
<tr>
<td>2</td>
<td>$</td>
<td>$</td>
</tr>
<tr>
<td>3</td>
<td>$</td>
<td>$</td>
</tr>
<tr>
<td>4</td>
<td>$</td>
<td>$</td>
</tr>
</table>
<hr>
<div id="outputDiv"></div>
</body>
</html>
Comment