The Script:
<script type="text/javascript"> function add(){ var tot=0,a=arguments,b=a.length; while(b--){ if(!a || isNaN(a[b]) || !a[b]){continue;} tot+= +a[b]; } return tot; } } </script>
The example:
<script type="text/javascript"> alert(add(1,2,3,4,5)); </script>
Try it
More Maths.