Ver Mensaje Individual
  #2 (permalink)  
Antiguo 11/01/2005, 13:28
Avatar de JavierB
JavierB
Colaborador
 
Fecha de Ingreso: febrero-2002
Ubicación: Madrid
Mensajes: 25.052
Antigüedad: 23 años
Puntos: 772
Hola deccweb

Prueba este ejemplo:
Código HTML:
<html>
<head>
<title>Untitled</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script>
function sumar(frm) {
  tot=0;
  tot+=frm.ra[0].checked ? parseInt(frm.ra[0].value) : 0;
  tot+=frm.ra[1].checked ? parseInt(frm.ra[1].value) : 0;
  tot+=parseInt(frm.txt.value);
  frm.total.value=tot;
}
</script>
</head>
<body>
<form>
<input type="radio" name="ra" value="15" />
<input type="radio" name="ra" value="70" />
<input type="text" name="txt" />
<input type="text" name="total" />
<input type="button" onclick="sumar(this.form)" />
</form>
</body>
</html> 
Saludos,