Ver Mensaje Individual
  #4 (permalink)  
Antiguo 03/10/2008, 10:27
antmegev
 
Fecha de Ingreso: septiembre-2008
Mensajes: 58
Antigüedad: 15 años, 9 meses
Puntos: 0
Respuesta: sumar los checkbox

solamente, algun comando para relacionar o scar el costo

lo tengo asi mas o menos pero no se si funcione
<body>
<script type="text/javascript">
function valuechecked(checkbox) {
for (i=0; i<checkbox.length; i++) {
if (checkbox[i].checked) {
return checkbox[i].value;
}
}
}
function sumar() {
var suma = 0;
suma += parseInt(valuechecked(form2.instalacion));
suma += parseInt(valuechecked(form2.componentes));
document.getElementById('sumatotal').innerHTML = suma;
}
</script>
<form id="form4" name="form4" method="post" action="">
<input type="checkbox" name="instalacion" id="instalacion" value="<?php echo $row_costos['inst_office']; ?>"/>
<input type="checkbox" name="componentes" id="componentes" value="="<?php echo $row_costos['inst_mouse']; ?>"/>
<p>suma: <span id="sumatotal"></span> pesos</p>
</body>