Ver Mensaje Individual
  #1 (permalink)  
Antiguo 30/01/2007, 09:35
Avatar de Epunamun
Epunamun
 
Fecha de Ingreso: noviembre-2004
Mensajes: 133
Antigüedad: 19 años, 5 meses
Puntos: 0
listas desplegables.

He visto las faq de las listas desplegables pero no me han funcionado.

no se cual es el error

ayuda porfavor.


Código:
´
<head>
<script language="JavaScript">
<%
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "DRIVER={Microsoft Access DRIVER (*.mdb)};DBQ=\\servidor\bd.mdb"
Sql_com = "Select distinct  nom_comuna, id_region from comuna "
set rs = CreateObject("ADODB.Recordset")
rs.Open Sql_com, Conn
x = 0
%>

function sublist(inform, selecteditem)
{
inform.Comuna.length = 0
<%
count= 0
y=0
Do While not rs.eof
%>
x = <%= trim(y) %>;
subcat = new Array();
subcatagorys = "<%=(rs("nom_comuna")) %>";
subcatagoryof = = "<%=(rs("id_region")) %>";
subcat[x,0] = subcatagorys;
subcat[x,1] = subcatagoryof;
if (subcat[x,1] == selecteditem) {
    var option<%= trim(count) %> = new Option(subcat[x,0],);
        inform.Comuna.options[inform.Comuna.length]=option<%= trim(count)%>;
}
<%
count = count + 1
y = y + 1
rs.movenext
loop
rs.close
%>
}
</script>
</head>
<body>
<select name="Region" onchange = "javascript:sublist(this.form,Region.value);">
<option selected>SELECCIONE UNA REGIÓN</option>
<%
region_Sql = "Select id_region, nom_region from region"
rs.Open region_Sql, Conn
Dim id_region
Dim nombre_region
Do while not rs.eof
%>
<option value="<%=rs("id_region")%>"><%=rs("nom_region")%></option>
<%rs.movenext
loop
set rs=nothing
Conn.close
set Conn=nothing%>
</select>

<select name="comuna" tabindex="6">
<option selected="selected" >SELECCIONE UNA COMUNA</option>
</select>
</body>
gracias