Ver Mensaje Individual
  #6 (permalink)  
Antiguo 15/12/2011, 15:16
lemonstar
 
Fecha de Ingreso: diciembre-2011
Mensajes: 9
Antigüedad: 12 años, 4 meses
Puntos: 0
Respuesta: Incremento de variable Ajax y checkbox

Lo logré hacer funcar con este script en el body

Código:
<script>

var clickHandlers = (function () {
var testform = document.getElementById("testform");
var totalcost = document.getElementById("totalcost");

testform.onclick = function (e) {
e = e || window.event;
var thisInput = e.target || e.srcElement;
var sel = document.getElementsByName('originales[]');
var sum = 0;
for (var i=0; i<sel.length; i++) {
if (sel[i].checked) { sum += parseFloat(sel[i].alt); }
}
totalcost.value = (sum > 0) ? sum.toFixed(2) : "";
}
return null;
}()); 
</script>

y un input donde se van asignando las sumas

Código:
<input type="text" id="totalcost" value="">
Gracias igualmente !