At 12:48 PM 9/30/02 -0400, S. Isaac Dealey wrote: >you could also use parseInt(string) or parseFloat(string) although if it >doesn't find an integer or a string at the beginning of the string it will >return "NaN" rather than "". Also if there are non-numeric values on the end >of the string it will remove them.
Ok, I got my two fields to add up and display in another field with this: onchange="window.document.ExpenseForm.TotalAmount#Line#.value=parseFloat(window.document.ExpenseForm.Mileage#Line#.value)+parseFloat(window.document.ExpenseForm.CostOfMeals#Line#.value);addTotals();" Now I'm trying to add up all the TotalAmounts and put it at the bottom of the form. I need to loop through the entire list from 1 to #list# on each onChange and update the GrandTotal. I can't figure out how to loop in Javascript and hand it a dynamic variable name. I tried this: <SCRIPT language="Javascript"> function addTotals() { i = 0 while (i <= #GetFormInfo.RecordCount#) { window.document.ExpenseForm.GrandTotalAmount.value=parseFloat(window.document.ExpenseForm.GrandTotalAmount.value)+parseFloat(eval("window.document.ExpenseForm.TotalAmount"+i+".value")); i++ } } </SCRIPT> But it doesn't work doesn't appear to go through each variable name. How would I do this? T ______________________________________________________________________ This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists