Click to See Complete Forum and Search --> : Investment Strategy Program
steelers75
04-16-2003, 09:37 PM
I'm working on a friends program and I don't see what is wrong with line 8, Char 2 with a message "document.Invest.years" is null or not an object
I have attached the htm file.
Could someone let me know what I'm missing?
Thanks,
Terry
steelers75
04-16-2003, 09:51 PM
Dave,
Yep there is a <form Name="Invest" align="center">
There is Name="Years" and its a text box that number of years is to be entered.
steelers75
04-16-2003, 10:01 PM
Yep the cases match but still has the same error.
steelers75
04-16-2003, 10:09 PM
Here's the code:
<!-- saved from url=(0022)http://internet.e-mail -->
<html>
<head>
<title>Tri Star Investing</title>
<script LANGUAGE="JAVASCRIPT">
<!--Hide from old browsers
function calculate(myform) {
var year=document.Invest.Years.value
var year=parseInt(year,10)
if (isNaN(year)) {
alert("Enter the years")
document.Invest.Years.value=" "
document.Invest.Years.focus()
} else {
var rate=document.Invest.IRate.value
var rate=parseInt(rate,10)
if (isNaN(rate)) {
alert("Enter the rate")
document.Invest.IRate.value=" "
document.Invest.IRate.focus()
} else {
var goals=document.Invest.Goal.value
var goals=parseInt(goals,10)
if (isNaN(goals)) {
alert("Enter your goal")
document.Invest.Goal.value=" "
document.Invest.Goal.focus()
} else {
mrate=rate/1200
deposists=year * 12
monthly=goals * mrate/((1 + mrate)^deposists -1)
document.Invest.Monthly.value=Invest
}
}
}
}
//-->
</script>
</head>
<body>
<center>
<img src="TriStarlogo.jpg" width="358" height="101"><img src="tickertape.jpg" width="88" height="101">
<p align="center"><Font color="darkred"><H3>Investment Strategy Page</H3></Font></p>
</Center>
<form Name="Invest" align="center">
</form>
<table border="0" width="80%">
<tr>
<td width="50%"><div align="right"><p>Years until retirement: </td>
<td width="50%"><input Type="text" Name="Years" value="" size="20"></td>
</tr>
<tr>
<td width="50%"><div align="right"><p>Estimated annual average interest: </td>
<td width="50%"><input Type="text" Name="IRate" value="" size="20"></td>
</tr>
<tr>
<td width="50%"><div align="right"><p>Retirement goal: </td>
<td width="50%"><input Type="text" Name="Goal" value=" " size="20"></td>
</tr>
<tr>
<td width="50%"><div align="right"><p>To reach your goal you need to save each month: </td>
<td width="50%"><input Type="text" Name="monthly" value=" " size="20"></td>
</tr>
<tr>
<td width="50%"><div align="right"><p><input Type="Button" value="Calculate" onclick="calculate()"></td>
<td width="50%"><input Type="Reset"></td>
</tr>
</table>
</form>
</body>
</html>
Just enter the number of years, interest rate and goal amount and click on the calculate button.