First you must try to code this first before asking here to get the source code, right? :)
Well, you must get the values of your field from 1 to 10, then add it altogether and set the TOTAL VALUE to your total field.
Call the jscript function on OnSave and Onchange of each fields.