Código HTML:
<script type="text/javascript">
function isNum(string) {
var valor = 0;
for (var i = 0, length = string.length; i < length; i++) {
valor = parseInt(string.charAt(i));
if(isNaN(valor)) return false;
}
return true;
}
function idForm(ff){
var campotemp;
var total = 0, value;
for(var a=0, length = ff.elements.length; a < length; a++) {
if(ff.elements[a].type == 'text'){
value = ff.elements[a].value;
if(value != '' && isNum(value)){
campotemp = parseInt(value);
total += campotemp;
} else return false;
}
}
alert(total);
}
</script>