Sorry there's a typo in that one, in the add function instead of:
document.forms['thisform'].elements['y'+1]
it should be:
document.forms['thisform'].elements['y'+i]
----- Original Message -----
From: "Alan Wolfe" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, July 08, 2004 11:23 AM
Subject: Re: Witango-Talk: Dynamically Adding Rows
> Hey Matthew,
>
> I attached something that hopefully will help you out!
>
> ----- Original Message -----
> From: "Witango" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, July 08, 2004 10:56 AM
> Subject: Witango-Talk: Dynamically Adding Rows
>
>
> > 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
>
> ________________________________________________________________________
> TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf
________________________________________________________________________
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf