Ver Mensaje Individual
  #8 (permalink)  
Antiguo 12/12/2010, 08:11
Avatar de IsaBelM
IsaBelM
Colaborador
 
Fecha de Ingreso: junio-2008
Mensajes: 5.032
Antigüedad: 15 años, 10 meses
Puntos: 1012
Respuesta: capturando valor de button radio

te he montado esto, espero que sea lo que buscas. si tienes alguna duda, ya sabes ......
Cita:
<html>
<head>
<script type="text/javascript">
window.onload = function() {
var rad = document.getElementsByTagName('input');
var total = 0;
for(var j = 0; j < rad.length; j++){
rad[j].onclick = function() {
total = 0;
for(var i = 0; i < rad.length; i++){
if(rad[i].checked) {
total += parseInt(rad[i].value);
}
}
document.getElementById('entrega').innerHTML = total;
}
}
}
</script>
</head>
<body>
<form>
<label for="p1" id="rad1">
<input type="radio" value="1" name="p1" />1
<input type="radio" value="2" name="p1" />2
<input type="radio" value="3" name="p1" />3
</label>
<br />
<label for="p2" id="rad2">
<input type="radio" value="1" name="p2" />1
<input type="radio" value="2" name="p2" />2
<input type="radio" value="3" name="p2" />3
</label>
<div id="entrega"></div>
</form>
</body>
</html>