Ver Mensaje Individual
  #2 (permalink)  
Antiguo 30/09/2005, 11:24
Avatar de tunait
tunait
Moderadora
 
Fecha de Ingreso: agosto-2001
Ubicación: Terok Nor
Mensajes: 16.805
Antigüedad: 23 años, 5 meses
Puntos: 381
Mu güenas Daz

te pongo un ejemplillo simple que creo te servirá

Código:
<script type="text/javascript">
<!--
var maxi = 4;
function validarCheck(f){
	cont = 0;
	for(m=0; m<f.pepe.length; m++){
		f.pepe[m].checked?cont++ : cont = cont;
	}
	if(cont > maxi){
		alert("Sólo puede elegir hasta " + maxi + " noticias secundarias\nDesmarque una de las 4 actualmente seleccionadas para poder marcar ésta.");
		return false
	}
	
}
//-->
</script>
</head>

<body>
<form name="form1" id="form1" method="post" action="javascript:alert('me envio')" onsubmit="return validarCheck(this)">
  <input type="checkbox" name="pepe" value="checkbox" />
  <input type="checkbox" name="pepe" value="checkbox" />
  <input type="checkbox" name="pepe" value="checkbox" />
  <input type="checkbox" name="pepe" value="checkbox" />
  <input type="checkbox" name="pepe" value="checkbox" />
  <input type="submit" name="Submit" value="Enviar" />
</form>
</body>