Okay, if anyone would be patient enough to troubleshoot this problem I'm having...
Basically, all I'm trying to do is read numbers in from textboxes, and use JavaScript to compute the total of those numbers. Then, I want to display the total in another textbox.
I can't seem to trouble shoot this feature, and I am no javascript expert, so any help would be appreciated. Refer below.
---------------------------------------------------------------------
<html>
<head>
<script language="JavaScript" src="gen_validatorv2.js" type="text/javascript"></script>
<title>forms.htm</title>
</head>
<body bgcolor="orange">
<center><h1>SERVICE REQUEST FORM</h1></center>
<form method="post" name="myform" action="xxx.htm">
<table border="1" align="center">
<tr>
<td width="50">
<label for="name"> Name</label>
</td>
<td width="350" colspan="2"><input type= "text" size="15" name="name">
</td>
</tr>
<tr>
<td width="50">
Address
</td>
<td colspan="2" width="350"><input type="text" size="25" name="address">
</td>
</tr>
<tr width="50">
<td>
City
</td>
<td colspan="2" width="350"><input type="text" size="15" name="city" id="city">
State
<input type="text" name="state" size="2" id="state">
Zip
<input type="text" name="zip" size="5" id="zip">
</td>
</tr>
<tr><td>Credit Card Number</td><td colspan="2"><input type="text" name="cc" size="5" id="cc"></td></tr>
<tr><td> </td><td colspan="2"> </td></tr>
<tr><td colspan="3">Services Requested:</td></tr>
<tr><td> </td><td> </td><td>Quantity Needed</td></tr>
<script language="JavaScript">
function compute()
{
var a = eval(document.myform.1.value);
var b = eval(document.myform.2.value);
var c = eval(document.myform.3.value);
var d = eval(document.myform.4.value);
var e = eval(document.myform.5.value);
var total = (a + b + c + d + e);
return total;
}
</script>
<tr><td> </td><td>Dog Walks</td><td><input type="text" name="1" value=0 id="1" size="2"
onChange="document.myform.total.value = compute()"></td></tr>
<tr><td> </td><td>Cat Care</td><td><input type="text" name="2" value=0 id="2" size="2"
onChange="document.myform.total.value = compute()"></td></tr>
<tr><td> </td><td>Bird Care</td><td><input type="text" name="3" value=0 id="3" size="2"
onChange="document.myform.total.value = compute()"></td></tr>
<tr><td> </td><td>Fish Care</td><td><input type="text" name="4" value=0 id="4" size="2"
onChange="document.myform.total.value = compute()"></td></tr>
<tr><td> </td><td>Other Care</td>
<td><input type="text" name="5" value=0 id="5" size="2"
onChange="document.myform.total.value = compute()"></td></tr>
<tr><td><input type ="text" name="total" id="total" size="10" value="0.00"></td><td> </td><td>
<tr><td valign="top">Comments</td><td colspan="2"><textarea cols="30" rows="10"></textarea></td></tr>
</table>
<center><input type="submit" name="submit" value="Submit">
<input type="reset" value="Reset"></center>
</form>
</body>
</html>