Código Javascript
:
Ver originalfunction sumar(c) {
var campo = document.getElementById('form1');
var n6 = document.getElementById('n6');
var subtotal = 0;
for (var i = 0; i < campo.length - 1; i++) {
if(campo[i] !== n6) // no sumar n6
subtotal += parseFloat(campo[i].value);
}
var resultado = Math.round(subtotal*100)/100
document.form1.res.value = resultado;
}
</script>
<form id="form1" name="form1" action="" method="post">
1:<input type="text" name="sum[]" value="0" onBlur="sumar(this.value);" /><br />
2:<input type="text" name="sum[]" value="0" onBlur="sumar(this.value);" /><br />
3:<input type="text" name="sum[]" value="0" onBlur="sumar(this.value);" /><br />
4:<input type="text" name="sum[]" value="0" onBlur="sumar(this.value);" /><br />
5:<input type="text" name="sum[]" value="0" onBlur="sumar(this.value);" /><br />
6:<input type="text" id="n6" name="nosumar" value="0" /><br />
Resultado:
<input type="text" id="res" name="res" value="0" />