Ver Mensaje Individual
  #2 (permalink)  
Antiguo 29/06/2009, 03:24
Avatar de caricatos
caricatos
Moderador
 
Fecha de Ingreso: abril-2002
Ubicación: Torremolinos (Málaga)
Mensajes: 19.607
Antigüedad: 22 años, 11 meses
Puntos: 1284
Respuesta: Duda con checkbox

Hola:

Tal vez te interese crear ese array en el momento de necesitarlo:

Código:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>
	http://www.caricatos.net/probador
</title>
<script type="text/javascript" >
var chs = new Array();
function mostrarChecks() {
 chs = new Array();
 f = document.forms[0];
 for (i = 0, total = f.ch.length; i < total; i ++)
  if (f.ch[i].checked) chs.push(f.ch[i].value);
}
</script>
</head>
<body>
<form onsubmit="mostrarChecks()" action="javascript: alert(chs)" >
<input type="checkbox" name="ch" value="ch1" />
<input type="checkbox" name="ch" value="ch2" />
<input type="checkbox" name="ch" value="ch5" />
<input type="checkbox" name="ch" value="ch6" />
<input type="checkbox" name="ch" value="ch7" />
<input type="checkbox" name="ch" value="ch8" />
<button type="submit" >ver</button>
</form>
</body>
</html>
Saludos
__________________
Por favor:
No hagan preguntas de temas de foros en mensajes privados... no las respondo