Ver Mensaje Individual
  #3 (permalink)  
Antiguo 18/06/2012, 18:59
Avatar de fjrueda
fjrueda
 
Fecha de Ingreso: marzo-2008
Ubicación: Bucaramanga
Mensajes: 313
Antigüedad: 16 años, 1 mes
Puntos: 35
Respuesta: sumar radios en un text box de un formulario y enviarlo

franciscoromano .... como dice ocp001a, este post deveria ser JS pero bueno se le puede colaborar.

ejemplo:
Código HTML:
<html>
<head>
<script>
var total=0;
function sumatoria(campo)
{
    var rta = document.getElementById('rta');
        
    if(campo.checked==true){ total=parseInt(rta.value) + parseInt(campo.value); }
    else{ total=parseInt(rta.value) - parseInt(campo.value); }

    if(total<0){ total=0; }

    rta.value = total;
}
</script>
<head>
<body>
<form name="form" id="form">
    Nota 1: <input type="checkbox" name="v1" id="v1" value="1" onClick="sumatoria(this);" />
    Nota 2: <input type="checkbox" name="v2" id="v2" value="2" onClick="sumatoria(this);" />
    Nota 3: <input type="checkbox" name="v3" id="v3" value="3" onClick="sumatoria(this);" />
    Total : <input type="text" name="rta" id="rta" value="0" />
</form>
</body>
</html> 
Pruebe, implementelo segun lo que usted necesita y nos cuenta.