Click to See Complete Forum and Search --> : Fpl calculator


retromad
07-08-2003, 02:28 PM
I am having difficulty getting the family size option working with this script. It is intended to calculate the % above or below the federal poverty line for use in our non-profit law firm
the math is as follows.

form.monthly.value = (form.monthly_income.value*12/(5840+(3140*(form.family_size)))*100;

I don't know alot about java so thanks in advance for any help you may provide

here is the entire thing.
<html>
<head>
<title>FPL Calculator</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<SCRIPT LANGUAGE="JavaScript">

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
function yfpl (form) {
form.yearly.value = (form.yearly_income.value/8976)*100;
}
function mfpl (form) {
form.monthly.value = (form.monthly_income.value*12/(5840+(3140*(form.family_size)))*100;
}
// End -->
</SCRIPT>
</head>

<body bgcolor="#FFFFFF" text="#000000">
<table width="400" border="0" height="200">
<tr>
<td colspan="2"><font face="Georgia, Times New Roman, Times, serif" size="2"><b>FPL
Calculator - either monthly or yearly income</b></font></td>
</tr>
<tr>
<td width="61">Monthly:</td>
<td rowspan="2">
<form>
<p> <font face="Georgia, Times New Roman, Times, serif"> <font size="2">
</font><font face="Georgia, Times New Roman, Times, serif"><font size="2">
<input type="text" name="monthly_income" value="Enter monthly income here" size="30">
</font></font><font size="2">
<input type="text" name="family_size" value="family size" size="10">
</font></font><font size="2">
<input type="button" value="Calculate" ONCLICK="mfpl(this.form)">
</font></p>
<p align="right"><font size="2" face="Georgia, Times New Roman, Times, serif">Their
income is
<input type="text" name="monthly">
% of FPL</font></p>
</form>
</td>
</tr>
<tr>
<td width="61">&nbsp;</td>
</tr>
<tr>
<td width="61">Yearly:</td>
<td rowspan="2">
<form name="form2" method="post" action="">
<p> <font size="2"> <font face="Verdana, Arial, Helvetica, sans-serif">
<input type="text" name="yearly_income" size="30" value="Enter yearly income here">
<input type="text" name="family_size2" value="family size" size="10">
</font><font face="Georgia, Times New Roman, Times, serif"><font size="2">
<input type="button" value="Calculate" onClick="yfpl(this.form)" name="button">
</font></font></font></p>
<p align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Their
income is
<input type="text" name="yearly">
% of FPL</font></p>
</form>
</td>
</tr>
<tr>
<td width="61">&nbsp;</td>
</tr>
</table>
</body>
</html>

thanks again
Jason Muma

Charles
07-08-2003, 02:47 PM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Content-Script-Type" content="text/javascript">
<style type="text/css">
<!--
label {display:block; margin:1ex}
input {margin-right:1em; width:5em}
-->
</style>
<form onsubmit="this.percent.value = ((this.income.value*12)/(5840+(3140*(this.persons.value)))*100).toFixed(4); return false">
<div>
<label><input type="text" name="income">Monthly family income in dollars</label>
<label><input type="text" name="persons">Family size in whole persons</label>
<hr>
<label><input type="text" name="percent">Percent of Fpl</label>
<button type="submit">Calculate</button>
</div>
</form>

retromad
07-09-2003, 02:05 PM
thanks a million! this works beautifully. If your ever in madison, WI I owe you a lunch.
-jsn