Ver Mensaje Individual
  #4 (permalink)  
Antiguo 08/09/2007, 08:29
Avatar de JavierB
JavierB
Colaborador
 
Fecha de Ingreso: febrero-2002
Ubicación: Madrid
Mensajes: 25.052
Antigüedad: 22 años, 3 meses
Puntos: 772
Re: Contar CheckBoxs Activados

Hola maderic_m

Prueba este código:

Código PHP:
<html>
<
head>
<
script type="text/javascript">
function 
contar(frm) {
  
suma 0;
  for (
i=0ele frm.elements[i]; i++)
    if (
ele.checkedsuma++;
  if (
suma>2) {
    
alert('Sólo 2');
    return 
false;
  }
}
</script>
</head>
<body>
<form onsubmit = "return contar(this)">
<input type="checkbox" />
<input type="checkbox" />
<input type="checkbox" />
<input type="submit" />
</form>
</body>
</html> 
Saludos,