I'm trying to write a javascript function for one of my Results pages to
add input text fields and place the result in another text field. My
problem is doing this for a variable number of rows on a given page.
Here's a simplified version of my implementation that only works in
Netscape/Mozilla right now. Any ideas how to get this to work in all
browsers? Thanks.
Matthew.
<script language="JavaScript">
function add(form, i)
{
form.eval("total"+i).value = (form.eval("x"+i).value-0) +
(form.eval("y"+i).value-0)
}
</script>
<form>
<table>
<@rows>
<tr>
<td><input name="x<@currow>" type="text"
onChange="add(this.form,<@currow>"></td>
<td><input name="y<@currow>" type="text"
onChange="add(this.form,<@currow>"></td>
<td><input readonly name="total<@currow>" type="text"></td>
</tr>
</@rows>
</table>
</form>
I also tried the following variation of the function but that doesn't work
either.
function add(form, i)
{
eval("form.total"+i+".value") = (eval("form.x"+i+".value")-0) +
(eval("form.y"+i+".value")-0)
}
________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf