Please can you help Have tried various means but cannot get this to work. The saver is prompted for the amount they wish to invest & a time period(in years) If initial investment is over £1000 & if investment period is more tham 12 years the interest rate is 7% otherwise use 6%. Have tried if else statement & two "for" statements but neither work..........< !-- Using the for loop -->
[HTML]<html>
<head>
<title>moneylin e.co.uk</title>
</head>
<body bgcolor="white" >
<script type = "text/javascript">
<!--
var amount=0.0, principal = 0.0, rate = .05,response;
response = window.prompt( "How much money would you like to invest ?", "0" );
principal=parse Float(response) ;
document.writel n(
"<table border = \"1\" width = \"100%\">" );
document.writel n(
"<caption> Invest money with us at 5% interest you earn </caption>" );
document.writel n(
"<thead><tr ><th align = \"left\">Yea r</th>" );
document.writel n(
"<th align = \"left\">Amo unt on deposit</th>" );
document.writel n( "</tr></thead>" );
for ( var year = 1; year <= 10; ++year ) {
amount = principal * Math.pow( 1.0 + rate, year );
document.writel n( "<tbody><tr><td >" + year +
"</td><td>" + Math.round( amount * 100 ) / 100 +
"</td></tr>" );
}
document.writel n( "</tbody></table>" );
// -->
</script>
</body>
</html>[/HTML]
[HTML]<html>
<head>
<title>moneylin e.co.uk</title>
</head>
<body bgcolor="white" >
<script type = "text/javascript">
<!--
var amount=0.0, principal = 0.0, rate = .05,response;
response = window.prompt( "How much money would you like to invest ?", "0" );
principal=parse Float(response) ;
document.writel n(
"<table border = \"1\" width = \"100%\">" );
document.writel n(
"<caption> Invest money with us at 5% interest you earn </caption>" );
document.writel n(
"<thead><tr ><th align = \"left\">Yea r</th>" );
document.writel n(
"<th align = \"left\">Amo unt on deposit</th>" );
document.writel n( "</tr></thead>" );
for ( var year = 1; year <= 10; ++year ) {
amount = principal * Math.pow( 1.0 + rate, year );
document.writel n( "<tbody><tr><td >" + year +
"</td><td>" + Math.round( amount * 100 ) / 100 +
"</td></tr>" );
}
document.writel n( "</tbody></table>" );
// -->
</script>
</body>
</html>[/HTML]
Comment