<html><div style='background-color:'><P>Thanks Lori, the isNaN function is what I needed. Thanks also Scott, your code snippet really helped.<BR><BR></P>
<BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #a0c6e5 2px solid; MARGIN-RIGHT: 0px"><FONT style="FONT-SIZE: 11px; FONT-FAMILY: tahoma,sans-serif">
<HR color=#a0c6e5 SIZE=1>
From: <I>"Mckinney, Lori K" &lt;lori.mckinney@intergraph.com&gt;</I><BR>Reply-To: <I>"\[JavaScript List\]" &lt;javascript@LaTech.edu&gt;</I><BR>To: <I>"[JavaScript List]" &lt;javascript@LaTech.edu&gt;</I><BR>Subject: <I>RE: [Javascript] Adding values in input boxes</I><BR>Date: <I>Thu, 1 Jun 2006 09:01:30 -0500</I><BR><BR>
<META content="Microsoft SafeHTML" name=Generator>
<DIV dir=ltr align=left><SPAN class=859344613-01062006><FONT face=Arial color=#0000ff size=2>How about using the isNaN(testValue) function for your test?&nbsp; NaN is not a string.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=859344613-01062006><FONT face=Arial color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=859344613-01062006><FONT face=Arial color=#0000ff size=2>total = isNaN(x1)?0:x1 + isNaN(y1)?0:y1 + isNaN(z1)?0:z1;</FONT></SPAN></DIV>
<DIV><SPAN class=859344613-01062006><FONT face=Arial color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=859344613-01062006><FONT face=Arial color=#0000ff size=2><A href="http://www.devguru.com/Technologies/ecmascript/quickref/isnan.html">http://www.devguru.com/Technologies/ecmascript/quickref/isnan.html</A></FONT></SPAN></DIV>
<DIV dir=ltr align=left><BR></DIV>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR>
<FONT face=Tahoma size=2><B>From:</B> javascript-bounces@LaTech.edu [mailto:javascript-bounces@LaTech.edu] <B>On Behalf Of </B>Alan Easton<BR><B>Sent:</B> Thursday, June 01, 2006 8:42 AM<BR><B>To:</B> javascript@LaTech.edu<BR><B>Subject:</B> [Javascript] Adding values in input boxes<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV>
<DIV class=RTE>Hello People,</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>I have 4 input boxes, 3 so I can enter numeric values in(c1, c2, c3), and the 4th to display the total.(total1)</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>I have put onblur actions on each of the 3 boxes like such: onBlur="addNumbers();"</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>My function is:</DIV>
<DIV class=RTE>---------------------------------------------</DIV>
<DIV class=RTE>function addNumbers() { <BR>&nbsp; <BR>&nbsp;&nbsp;&nbsp; var x1, y1, z1</DIV>
<DIV class=RTE>&nbsp;var x = parseInt(frmAIMSsignup.c1.value);<BR>&nbsp;var y = parseInt(frmAIMSsignup.c2.value);<BR>&nbsp;var z = parseInt(frmAIMSsignup.c3.value);<BR>&nbsp;<BR>&nbsp;if (x != 'NaN')<BR>&nbsp;{<BR>&nbsp;x1 = x;<BR>&nbsp;}<BR>&nbsp;else<BR>&nbsp;{<BR>&nbsp;x1 = 0;<BR>&nbsp;}<BR>&nbsp;if (y != 'NaN')<BR>&nbsp;{<BR>&nbsp;y1 = y;<BR>&nbsp;}<BR>&nbsp;else<BR>&nbsp;{<BR>&nbsp;y1 = 0;<BR>&nbsp;}<BR>&nbsp;if (z != 'NaN')<BR>&nbsp;{<BR>&nbsp;z1 = z;<BR>&nbsp;}<BR>&nbsp;else<BR>&nbsp;{<BR>&nbsp;z1 = 0;<BR>&nbsp;}</DIV>
<DIV class=RTE>&nbsp;&nbsp;&nbsp; var totcol1 = x1 + y1 + z1;<BR><BR>&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp; frmAIMSsignup.total1.value = totcol1; <BR>} </DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>&lt;/script&gt;</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>---------------------------------------------</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>I am adding then OK, except when no numeric value is in the input box. I simply want to be able to add up the 3 boxes when any of them change, but also catch when nothing has been entered.i.e. when the value is undefined.</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>Does anyone have any ideas. I would appreciate any help.</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>Many Thanks,</DIV>
<DIV class=RTE>&nbsp;</DIV>
<DIV class=RTE>Al...</DIV></DIV><BR>
<P>&gt;_______________________________________________<BR>&gt;Javascript mailing list<BR>&gt;Javascript@LaTech.edu<BR>&gt;https://lists.LaTech.edu/mailman/listinfo/javascript<BR>
<P></FONT></P></BLOCKQUOTE></div></html>