total =+ total + parseInt( x); Cheers! Mark
-- Try before you cry: http://www.mail-archive.com/struts-user%40jakarta.apache.org/ -----Original Message----- From: SUPRIYA MISRA [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 14, 2002 10:00 AM To: [EMAIL PROTECTED] Subject: Re: Indexed Tag and JavaScript Problem Now I have another problem. In JavaScirpt I have; var total=0.0; var x; for loop x=document.currentForm.elements["actHour["+loop+"].faHrsDay1"].value; alert(x); total=total+x; alert(total); end loop x gets the correct values like 1,2,3 but total=0.0 then 0.01, then 0.012 and so on. It is doing string concatenation instead of adding them. JavaScript Gurus please help. >From: "Adam Grohs" <[EMAIL PROTECTED]> >Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]> >To: "Struts Users Mailing List" <[EMAIL PROTECTED]> >Subject: Re: Indexed Tag and JavaScript Problem >Date: Mon, 16 Jul 2001 09:02:32 -0400 > >Your syntax is causing the browser's js interpreter is looking for >"actHour1" as an array object in the JavaScript code, it will return object >expected errors because the form elements name is actually >"actHour[1].faHrsDay1" and there is likely no such array object elsewhere >in >your JavaScript on the page. The following should work: > >document.currentForm.elements["actHour[1].faHrsDay1"].value > >Hope this helps, >Adam S. Grohs >----- Original Message ----- >From: "SUPRIYA MISRA" <[EMAIL PROTECTED]> >To: <[EMAIL PROTECTED]> >Sent: Thursday, February 14, 2002 9:50 AM >Subject: Indexed Tag and JavaScript Problem > > > > Since I am using Indexed tag, my form gets the the following structure > > > > <form name="currentForm" method="POST" action="/FALS/displaylog.do"> > > > > <td align=left><input type="text" name="actHour[1].faHrsDay1" >maxlength="4" > > size="6" value="0.0" onchange="update(1,1,3)"> > > > > <form> > > > > > > the update function is in JavaScript where I want to do some check. > > How to I access the form element? > > > > document.currentForm.actHour[1].faHrsDay1.value=1+1+3 does not work. > > > > error message from JavaScript is as follows. > > actHour1 is not an object > > > > HELP !!!! > > > > > > _________________________________________________________________ > > MSN Photos is the easiest way to share and print your photos: > > http://photos.msn.com/support/worldwide.aspx > > > > > > -- > > To unsubscribe, e-mail: ><mailto:[EMAIL PROTECTED]> > > For additional commands, e-mail: ><mailto:[EMAIL PROTECTED]> > > > > > > >-- >To unsubscribe, e-mail: ><mailto:[EMAIL PROTECTED]> >For additional commands, e-mail: ><mailto:[EMAIL PROTECTED]> > _________________________________________________________________ Join the world's largest e-mail service with MSN Hotmail. http://www.hotmail.com -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>