JavaScript Source Code 3000: Calculators: Savings Estimator
Savings Estimator
Enter how much you can afford to save each month, how long you can save this amount, and the interest rate you can get on your savings and this script will display your total savings.
Total invested each month:
Number of months/years to aquire sum:
Months
Years
Interest rate on savings:
%
Total :
JavaScript Source Code 3000: Calculators: Savings Estimator
Simply click inside the window below, use your cursor to highlight the script, and copy (type Control-c or Apple-c) the script into a new file in your text editor (such as Note Pad or Simple Text) and save (Control-s or Apple-s). The script is yours!!!
<!-- TWO STEPS TO INSTALL SAVINGS ESTIMATOR:
1. Copy the coding into the HEAD of your HTML document
2. Add the last code into the BODY of your HTML document -->
<!-- STEP ONE: Paste this code into the HEAD of your HTML document -->
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Michael C. Hundt (mchundt@nglic.com) -->
<!-- Web Site: http://www.cinet.net/~mhundt/mystuff.htm -->
<! >
<! >
<!-- Begin
var i = 0; // interest
var m = 0; // months
var f = 0; // factor
var den = 0;
var s = "0"; // string
var d = 0; // decimal place
function CalcA() {
if(document.calform.interest.value=="" || document.calform.months.value=="" || document.calform.payment.value=="") {
alert("Please fill in all of the required fields.");
}
else {
if(document.calform.period.options[1].selected == true) {
m = document.calform.months.value * 12;
}
else {
m = document.calform.months.value;
}
i = Math.pow(((document.calform.interest.value/100)+1),.0833333)-1;
den = i / (i+1);
f = Math.pow((i+1),m)-1;
f /= den;
f *= document.calform.payment.value;
d = String(f).indexOf(".");
s = String(f).substring(0,(d+3));
document.calform.total.value = "$" + s;
}
}
// End -->
</script>
</HEAD>
<!-- STEP TWO: Copy this code into the BODY of your HTML document -->
<BODY>
<center>
<form method=post name="calform">
<table width=400>
<tr>
<td align=right width=200>Total invested each month:</td>
<td><input type=text name=payment size=13 maxlength=13></td>
</tr>
<tr>
<td align=right width=200>Number of months/years to aquire sum:</td>
<td><input type=text name=months size=3 maxlength=3>
<select name=period size=1>
<option value="m">Months
<option value="y">Years
</select>
</td>
</tr>
<tr>
<td align=right width=200>Interest rate on savings:</td>
<td><input type=text name=interest size=5 maxlength=5><b> %</b></td>
</tr>
<tr>
<td width=200 colspan=2 align=center> <br>
<input type=button name=button1 value="How much will I have?" onClick="javascript:CalcA()"></td>
</tr>
<tr>
<td colspan=2 align=center width=100>Total :
<input type=text name=total value="0.00" size=15 maxlength=15></td>
</tr>
</table>
</form>
</center>
<!-- Script Size: 2.32 KB -->
Wyszukiwarka
Podobne podstrony:
saving space pl 6the estimation of?fort?sed on use?ses?41D15Bestimating?fort using the wide band?lphi technique?C30635estimating project?fort315FF9Esaving space pl 2saving space pl 3SavingLadyIlsa14 Estimating and Bidding Fiber Optic InstallationXAuto estima05 Register Saving Conventions and Local Variablessaving space plSaving Space plwięcej podobnych podstron