Ver Mensaje Individual
  #6 (permalink)  
Antiguo 27/05/2003, 06:33
Axo
 
Fecha de Ingreso: abril-2003
Ubicación: Virtual
Mensajes: 953
Antigüedad: 21 años, 10 meses
Puntos: 7
Código:
   
<script>
var total=0;
function sumar(chk,valor) {
if (chk.checked)
total+=valor; 
document.formulario.total.value=total;
}

function restar(chk,valor) {
if (chk.checked)
total-=valor; 

document.formulario.total.value=total;
}
</script>

<input name="checkbox" type="checkbox" onClick="if (this.checked) sumar(this,3); else restar(this,3)" value="checkbox">

Lo tengo asi y no rula !! Probe tambien haciendolo asi:

function restar(chk,valor) {
if (chk.checked)
total=total-valor; // Ya que son mas checkbox y deberia restarle la cantidad al total...