We have a script that's supposed to tell the user how much money they save or lose over a certain period (for example, how much money they have left over each month after bills). The problem is that it doesn't show the answer after the user clicks "Calculate". What's wrong?
// This Calculator generated by the
// Budget Calculator Generator Javascript
// at http://javascript.about.com/library/blbudget.htm
function stripBlanks(fld) {var result = "";var c = 0;for (i=0; i < fld.length; i++) {if (fld.charAt(i) != " " || c > 0){ result += fld.charAt(i); if (fld.charAt(i) != " ") c = result.length;}} return result.substr(0,c);}
function budget(thisform) {
var result = 0;
var in1 = stripBlanks(thisform.in1.value);
if (in1 != '' && in1 != parseFloat(in1)) {alert("Paychecks must be numeric");thisform.in1.focus();return false;}
result += Number(in1);
var in2 = stripBlanks(thisform.in2.value);
if (in2 != '' && in2 != parseFloat(in2)) {alert("Other must be numeric");thisform.in2.focus();return false;}
result += Number(in2);
var ex01 = stripBlanks(thisform.ex01.value);
if (ex01 != '' && ex01 != parseFloat(ex01)) {alert("Rent/Mortgage must be numeric");thisform.ex01.focus();return false;}
result -= (ex01 * pd);
var ex02 = stripBlanks(thisform.ex02.value);
if (ex02 != '' && ex02 != parseFloat(ex02)) {alert("Utilities must be numeric");thisform.ex02.focus();return false;}
result -= (ex02 * pd);
var ex03 = stripBlanks(thisform.ex03.value);
if (ex03 != '' && ex03 != parseFloat(ex03)) {alert("Phone must be numeric");thisform.ex03.focus();return false;}
result -= (ex03 * pd);
var ex04 = stripBlanks(thisform.ex04.value);
if (ex04 != '' && ex04 != parseFloat(ex04)) {alert("Internet must be numeric");thisform.ex04.focus();return false;}
result -= (ex04 * pd);
var ex05 = stripBlanks(thisform.ex05.value);
if (ex05 != '' && ex05 != parseFloat(ex05)) {alert("Auto loan must be numeric");thisform.ex05.focus();return false;}
result -= (ex05 * pd);
var ex06 = stripBlanks(thisform.ex06.value);
if (ex06 != '' && ex06 != parseFloat(ex06)) {alert("Auto insurance must be numeric");thisform.ex06.focus();return false;}
result -= (ex06 * pd);
var ex07 = stripBlanks(thisform.ex07.value);
if (ex07 != '' && ex07 != parseFloat(ex07)) {alert("Gas must be numeric");thisform.ex07.focus();return false;}
result -= (ex07 * pd);
var ex08 = stripBlanks(thisform.ex08.value);
if (ex08 != '' && ex08 != parseFloat(ex08)) {alert("Public transportation must be numeric");thisform.ex08.focus();return false;}
result -= (ex08 * pd);
var ex09 = stripBlanks(thisform.ex09.value);
if (ex09 != '' && ex09 != parseFloat(ex09)) {alert("Non motorized transportation must be numeric");thisform.ex09.focus();return false;}
result -= (ex09 * pd);
var ex10 = stripBlanks(thisform.ex10.value);
if (ex10 != '' && ex10 != parseFloat(ex10)) {alert("Groceries must be numeric");thisform.ex10.focus();return false;}
result -= (ex10 * pd);
var ex11 = stripBlanks(thisform.ex11.value);
if (ex11 != '' && ex11 != parseFloat(ex11)) {alert("Restaurant must be numeric");thisform.ex11.focus();return false;}
result -= (ex11 * pd);
var ex12 = stripBlanks(thisform.ex12.value);
if (ex12 != '' && ex12 != parseFloat(ex12)) {alert("Life insurance must be numeric");thisform.ex12.focus();return false;}
result -= (ex12 * pd);
var ex13 = stripBlanks(thisform.ex13.value);
if (ex13 != '' && ex13 != parseFloat(ex13)) {alert("Property insurance must be numeric");thisform.ex13.focus();return false;}
result -= (ex13 * pd);
var ex14 = stripBlanks(thisform.ex14.value);
if (ex14 != '' && ex14 != parseFloat(ex14)) {alert("Credit card must be numeric");thisform.ex14.focus();return false;}
result -= (ex14 * pd);
var ex15 = stripBlanks(thisform.ex15.value);
if (ex15 != '' && ex15 != parseFloat(ex15)) {alert("Student loan must be numeric");thisform.ex15.focus();return false;}
result -= (ex15 * pd);
var ex16 = stripBlanks(thisform.ex16.value);
if (ex16 != '' && ex16 != parseFloat(ex16)) {alert("Other loan must be numeric");thisform.ex16.focus();return false;}
result -= (ex16 * pd);
var ex17 = stripBlanks(thisform.ex17.value);
if (ex17 != '' && ex17 != parseFloat(ex17)) {alert("Entertainment must be numeric");thisform.ex17.focus();return false;}
result -= (ex17 * pd);
var ex18 = stripBlanks(thisform.ex18.value);
if (ex18 != '' && ex18 != parseFloat(ex18)) {alert("Beauty must be numeric");thisform.ex18.focus();return false;}
result -= (ex18 * pd);
var ex19 = stripBlanks(thisform.ex19.value);
if (ex19 != '' && ex19 != parseFloat(ex19)) {alert("Clothing must be numeric");thisform.ex19.focus();return false;}
result -= (ex19 * pd);
var ex20 = stripBlanks(thisform.ex20.value);
if (ex20 != '' && ex20 != parseFloat(ex20)) {alert("Medical must be numeric");thisform.ex20.focus();return false;}
result -= (ex20 * pd);
thisform.res.value = result;}
<html>
<head>
<script type="text/javascript" src="http://ourdomain.com/budget-calculator.js"></script>
</head>
<body>
<form name="budcalc"><table align="center" border="0" class="budcalc">
<tr><th colspan="2"><h3 align="center">Budget Calculator</h3></th></tr>
<tr><th colspan="2" align="left">Income</th></tr>
<tr><td align="right">Paychecks:</td><td align="left"><input type="text" name="in1" size="10"></td></tr>
<tr><td align="right">Other:</td><td align="left"><input type="text" name="in2" size="10"></td></tr>
<tr><th colspan="2" align="left">Expenses</th></tr>
<tr><td align="right">Rent/Mortgage:</td><td align="left"><input type="text" name="ex01" size="10"></td></tr>
<tr><td align="right">Utilities:</td><td align="left"><input type="text" name="ex02" size="10"></td></tr>
<tr><td align="right">Phone:</td><td align="left"><input type="text" name="ex03" size="10"></td></tr>
<tr><td align="right">Internet:</td><td align="left"><input type="text" name="ex04" size="10"></td></tr>
<tr><td align="right">Auto loan:</td><td align="left"><input type="text" name="ex05" size="10"></td></tr>
<tr><td align="right">Auto insurance:</td><td align="left"><input type="text" name="ex06" size="10"></td></tr>
<tr><td align="right">Gas:</td><td align="left"><input type="text" name="ex07" size="10"></td></tr>
<tr><td align="right">Public transportation:</td><td align="left"><input type="text" name="ex08" size="10"></td></tr>
<tr><td align="right">Non motorized transportation:</td><td align="left"><input type="text" name="ex09" size="10"></td></tr>
<tr><td align="right">Groceries:</td><td align="left"><input type="text" name="ex10" size="10"></td></tr>
<tr><td align="right">Restaurant:</td><td align="left"><input type="text" name="ex11" size="10"></td></tr>
<tr><td align="right">Life insurance:</td><td align="left"><input type="text" name="ex12" size="10"></td></tr>
<tr><td align="right">Property insurance:</td><td align="left"><input type="text" name="ex13" size="10"></td></tr>
<tr><td align="right">Credit card:</td><td align="left"><input type="text" name="ex14" size="10"></td></tr>
<tr><td align="right">Student loan:</td><td align="left"><input type="text" name="ex15" size="10"></td></tr>
<tr><td align="right">Other loan:</td><td align="left"><input type="text" name="ex16" size="10"></td></tr>
<tr><td align="right">Entertainment:</td><td align="left"><input type="text" name="ex17" size="10"></td></tr>
<tr><td align="right">Beauty:</td><td align="left"><input type="text" name="ex18" size="10"></td></tr>
<tr><td align="right">Clothing:</td><td align="left"><input type="text" name="ex19" size="10"></td></tr>
<tr><td align="right">Medical:</td><td align="left"><input type="text" name="ex20" size="10"></td></tr>
<tr><td align="right"> Number of months:</td><td align="left"><input type="text" name="pd" size="3"></td></tr>
<tr><td> </td><td><input type="button" value="Calculate" onclick="budget(budcalc);return false;"></td></tr>
<tr><td align="right"><b>Savings:</b></td><td align="left"><input type="text" name="res" size="10" readonly="readonly"></td></tr></table></form>
</body>
</html>