I am working on this program that will show interest in an account for each year for 10 years. I want to click on a button and it display the interest for each year for 10 years.
The box shows up but the calcuations do as well. It all comes up at once. I dont know what I am suppose to use for onClick="show()"> that is all I have used in the past so I am lost here!
Here is what I have so far:
<HTML>
<head>
<title> Calcuate interest for 10 years </title>
<script language="javascript">
function a(p,r,n)
{
return (parseFloat(p) * Math.pow( (1+parseFloat(r)), parseInt(n,10) )).toFixed(2);
}
var i=1;
while(i<=10)
{
document.write( i + ". "+ a("1000.00",".05",i) +"<br />");
++i;
}
</script>
</head>
<Body>
<p><input type="button" value="click to calcuate interest for 10 years" onClick="function a(p,r,n)">
</body>
</HTML>