I have met this problem before. The only solution I have found is to assign "0" values to the INPUT tags: <input type="text" name="field1" addChange="add();" value="0"> HTH Ignatius ____________________________________________ ----- Original Message ----- From: "Shahmat Dahlan" <shahmatd@sains.com.my> To: <php-db@lists.php.net> Sent: Friday, October 11, 2002 11:34 AM Subject: Javascript > My question might have anything to do with PHP but I have the following > scenario: > > Say I have four fields > field1 : XXXXXXXXXXXX > field2 : XXXXXXXXXXXX > field3 : XXXXXXXXXXXX > field4 : XXXXXXXXXXXX > > And a total sum field, which is a total sum of the value of the > expression, totalsum = field1 + field2 + field3 + field4 > Total sum : XXXXXXXXXXX > > You would need to use Javascript to extract the value of field1, field2, > field3, field4, initiated by the Javascript onChange event. > > The HTML codes should look like this: > <input type="text" name="field1" addChange="add();"> > <input type="text" name="field2" addChange="add();"> > <input type="text" name="field3" addChange="add();"> > <input type="text" name="field4" addChange="add();"> > <input type="text" name="totalsum"> > > So the add function snippet that I have: > > function add() > { > var thisform=document.forms[0]; > var field1=thisform.field1.value; > var field2=thisform.field2.value; > var field3=thisform.field3.value; > var field4=thisform.field4.value; > var totalqty=field1+field2+field3+field4; > thisform.totalsum.value=totalqty; > } > > But all I got is a NaN which means Not A Number. I understand that you > solve this by using the parseInt Javascript function. > But still all i get is a NaN value. > > Would appreciate if someone could help me out on this. > > Regards > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php