Ver Mensaje Individual
  #2 (permalink)  
Antiguo 21/05/2009, 13:32
Avatar de rudy69
rudy69
 
Fecha de Ingreso: octubre-2008
Ubicación: espndeportes.com
Mensajes: 195
Antigüedad: 16 años, 4 meses
Puntos: 7
Respuesta: ayuda grupo checkbox

Código HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript" language="javascript">
function maxCheck() {
	var contar = 0;
	var i=0;
	for(i=0; i<document.form.checkbox.length; i++) {
		if(document.form.checkbox[i].checked) {
			contar=contar+1;
		}
		
		if(contar>2) {
			alert('has seleccionado mas de dos');
			return false;
		}
	}
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
<form name="form">
<input name="checkbox" type="checkbox" onclick="return maxCheck()" value="1" />
<input name="checkbox" type="checkbox" onclick="return maxCheck()" value="2" />
<input name="checkbox" type="checkbox" onclick="return maxCheck()" value="3" />
<input name="checkbox" type="checkbox" onclick="return maxCheck()" value="4" />
<input name="checkbox" type="checkbox" onclick="return maxCheck()" value="5" />
<input name="checkbox" type="checkbox" onclick="return maxCheck()" value="6" />
<input name="checkbox" type="checkbox" onclick="return maxCheck()" value="7" />
<input name="checkbox" type="checkbox" onclick="return maxCheck()" value="8" />
</form>
</body>
</html> 
A ver si esto te ayuda, no permite checar mas de dos :P