hello Ihave the following code <html> <head> <script type="text/javascript" > function summation(rowNumber) { [COLOR="Red"][SIZE="3"]//loop for all text bottons in row numbered "rowNumber" and evaluate the summation Y of thier values.[/SIZE][/COLOR] result.value=Y; } </script> </head> <body> <table style="width: 100%"> <tr id="row1"> <td > <input name="Text1" id="Text1" type="text" /> <input name="Text2" id="Text2" type="text" /> <input name="Text3" id="Text3" type="text" /> <input name="Text4" id="Text4" type="text" /> <input name="Text5" id="Text5" type="text" /> [CODE][COLOR="Red"][SIZE="3"]this page my conatain variant number of text bottons....[/SIZE][/COLOR] Code (markup): </td> <td> <input name="Button1" type="button" onclick="summation('row1')" value="summation" /><input id="result" type="text" /> </td> </tr> </table> </body> </html>[/CODE] I have this code , note this page contain variant number of text bottons. I want to calculate the mathimatical summation of values of these bottons ? so i want to calculate the items contained into a row with id "row1"? another question: how to make textbotton accept numbers only ? thanks
get jquery and use the following: function summation(rowNumber){ var result = 0 $(rowNumber+" input[type=text]").each(function(){ result += parseint($(this).val()); }); return result; }