Foros del Web » Programando para Internet » Javascript »

Lista dependiente con un input text

Estas en el tema de Lista dependiente con un input text en el foro de Javascript en Foros del Web. ok necesito hacer una lista dependiente con la siguiente cualidad. 1 Comidas 1.1 Arroz 1.2 Pan 1.3 Tortilla 2 Bebidas 2.1 Pepsi 2.2 Coca 3.3 ...
  #1 (permalink)  
Antiguo 11/08/2005, 19:09
Avatar de affv  
Fecha de Ingreso: diciembre-2002
Ubicación: Ahora aqui
Mensajes: 485
Antigüedad: 21 años, 9 meses
Puntos: 0
Lista dependiente con un input text

ok necesito hacer una lista dependiente con la siguiente cualidad.
1 Comidas
1.1 Arroz
1.2 Pan
1.3 Tortilla
2 Bebidas
2.1 Pepsi
2.2 Coca
3.3 Natural
3 Otros
1.1 <input type="text" name="T1" size="20">
(esto para que la ultima opcion pueda ser variable.)

El codigo que utilizo para hacer la lista variable es este
Código HTML:
<html>

<head>
<title></title>
<script languaje="JavaScript">
<!--
Informacion = new Array();
Informacion[0] = new Array();
Informacion[1] = new Array('Arroz','Pan','Tortilla');
Informacion[2] = new Array('Pepsi','Coca','Natural');
Informacion[3] = new Array('Aqui debe de mostrar el input en lugar de este select');

function cambiar(formulario){
var i = 0;
var select1 = formulario['Seleccion'];
var select2 = formulario['Opcion'];
var vector = Informacion[select1.selectedIndex];
if(vector.length)select2.length=vector.length;
while(vector[i]){
select2.options[i].value = vector[i];
select2.options[i].text = vector[i];
i++;
}
select2.options[0].selected = 1;
}
-->
</script>
</head>

<body>
<form name="MyForm">
	<select name="Seleccion" onchange="cambiar(this.form)" class="Textbox">
		<option>-</option>
		<option>Comidas</option>
		<option>Bebidas</option>
		<option>Otros</option>
	</select>
	<select name="Opcion" class="Textbox">
		<option>-</option>
	</select>
</form>
</body>

</html> 
__________________
Todo tiene un comienzo y un fin!!
Postea tus proyectos
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 13:08.