I am working on dynamically building a section of HTML from a table that has a one to many relationship with a parent table. The parent table is a table of borrower information, the child is a debt table which contains an entry for each liability a borrower has. I am not having trouble looping through and building the HTML, but I have javascript code that totals all of the debts. Here is the JS Code:<BR><BR><BR>function calcTotalPayPayoff() { <BR><BR> var tempBal = 0; <BR><BR> m1 = document.analysis.debt_1_pay_payoff.value;<BR> m2 = document.analysis.debt_2_pay_payoff.value;<BR> m3 = document.analysis.debt_3_pay_payoff.value;<BR> m4 = document.analysis.debt_4_pay_payoff.value;<BR> m5 = document.analysis.debt_5_pay_payoff.value;<BR> m6 = document.analysis.debt_6_pay_payoff.value;<BR> m7 = document.analysis.debt_7_pay_payoff.value;<BR> m8 = document.analysis.debt_8_pay_payoff.value;<BR> m9 = document.analysis.debt_9_pay_payoff.value;<BR> m10 = document.analysis.debt_10_pay_payoff.value;<BR> m11 = document.analysis.debt_11_pay_payoff.value;<BR> m12 = document.analysis.debt_12_pay_payoff.value;<BR> m13 = document.analysis.debt_13_pay_payoff.value;<BR> m14 = document.analysis.debt_14_pay_payoff.value;<BR> m15 = document.analysis.debt_15_pay_payoff.value;<BR> m16 = document.analysis.debt_16_pay_payoff.value;<BR> m17 = document.analysis.debt_17_pay_payoff.value;<BR> m18 = document.analysis.debt_18_pay_payoff.value;<BR> m19 = document.analysis.debt_19_pay_payoff.value;<BR> m20 = document.analysis.debt_20_pay_payoff.value;<BR> m21 = document.analysis.debt_21_pay_payoff.value;<BR> m22 = document.analysis.debt_22_pay_payoff.value;<BR> m23 = document.analysis.debt_23_pay_payoff.value;<BR> m24 = document.analysis.debt_24_pay_payoff.value;<BR><BR > for (i = 1; i <= 24; i++) {<BR><BR> mtempStr = eval("m" + i);<BR><BR> if ( isNaN(mtempStr) || mtempStr == "") {<BR> // Do not add this value because it's blank or a string<BR> } else {<BR> tempBal = tempBal + (parseFloat(mtempStr));<BR> }<BR><BR> }<BR> <BR> document.analysis.total_pay_payoff.value = (parseFloat(tempBal)); <BR><BR>}<BR><BR>It is a little crude, but it was the best I could do without actually knowing a whole world about JS.<BR><BR>Here is the ASP code:<BR><BR> <%<BR> Dim debtRS, strSQLdebt, strcreditor, strname1, strname2, strname3, strname4,i<BR> <BR> i = 1<BR> <BR> strcreditor = "creditor_" & i<BR> strname1 = "debt_" & i & "_bal_payoff"<BR> strname2 = "debt_" & i & "_bal_remain"<BR> strname3 = "debt_" & i & "_pay_payoff"<BR> strname4 = "debt_" & i & "_pay_remain"<BR> strSQLdebt = "select * from debts where file_number = '" & file_number & "'"<BR> <BR> set debtRS = dbRS(strSQLdebt)<BR> While not debtRS.eof<BR> %><BR> <tr> <BR> <td width = "40%" align = "middle"><BR> <input class = "small" name = "<% = strcreditor%>" size = "28" value = "<%= debtRS("creditor")%>"><BR> </td><BR> <BR> <td width = "15%" align = "middle"><BR> <input class = "small" name ="<% = strname1%>" size = "7" value = "<% = debtRS("balance_payoff")%>" onblur = "calcTotalBalPayoff();calcBorrCash()"><BR > </td><BR> <BR> <td width = "15%" align = "middle"><BR> <input class = "small" name ="<% = strname3%>" size = "5" value = "<% = debtRS("payment_payoff")%>" onblur = "calcTotalPayPayoff()"><BR> </td> <BR> <BR> <td width = "15%" align = "middle"><BR> <input class = "small" name ="<% = strname2%>" size = "7" value = "<% = debtRS("balance_remain") %>" onblur = "calcTotalBalRemain()"><BR> </td><BR> <BR> <td width = "15%" align = "middle"><BR> <input class = "small" name = "<% = strname4%>" size = "5" value = "<% = debtRS("payment_remain") %>" onblur = "calcTotalPayRemain();ratecalc()" <BR> ><BR> </td><BR> </tr><BR><BR> <%<BR> i = i + 1<BR> debtRS.movenext<BR> Wend<BR> debtRS.close<BR> set debtRS = nothing<BR> %><BR><BR>Sorry, the formatting is a little hosed in this venue. Here is the issue:<BR><BR>i is being overwritten as i at the beginning. I tried adding the following code:<BR><BR>for i = 1 to 24 (Placed into the first portion of asp code with the variable declarations.<BR><BR>And next placed into the second piece of ASP code with the movenext command. It gave me an error with unexpected next. I tried placing the next into the first block of code, but it just loops through 24 times and then uses i as 24.<BR><BR>Bleh.<BR><BR>If anyone sees a better way to work through this, do let me know. I am going to face an issue with the way the javascript is written, because there is not always going to be 24 debts, does anyone see a good way to overcome this one? Thanks in advance cats and kittens.<BR>