Ver Mensaje Individual
  #7 (permalink)  
Antiguo 29/09/2004, 07:29
Avatar de Saruman
Saruman
 
Fecha de Ingreso: mayo-2003
Ubicación: Panama city, Panama, Panama
Mensajes: 1.154
Antigüedad: 22 años
Puntos: 5
hola, esto es lo que yo hice y estoy utilizando actualmente....
espero te sirva...
solo copie lo que venia al tema y no lo he probado asi solo...
me avisas si captas el mensaje y si te funciono:

Código:
<%
	sSQL = "select * from catalogo_categorias where tipo_producto=" & tipo_producto & " order by titulo"
	set RSCategorias = Master.Execute(sSQL)
%>

<script language="javascript">
	function cambiarcategoria(codcategoria) {
		var f = document.form1
		
		var subcategorias_tituo = new Array();
		var subcategorias_codigo = new Array();
		
		if (f.categorias.value != 0) {
<%
			I = 0
			if RSCategorias.bof=false and RSCategorias.eof=false then
				while not RSCategorias.eof
					sSQL = "select * from catalogo_subcategorias where categoria=" & RSCategorias("codigo") & " and tipo_producto=" & tipo_producto & " order by titulo"
					set RSSubCategorias = Master.Execute(sSQL)
					
					J = 0
					response.Write("if (codcategoria == " & RSCategorias("codigo") & ") {") & vbcrlf
					response.Write(vbtab & "f.subcategorias.options.length = 0;")
					response.Write(vbtab & "sub" & J & " = new Option(""Seleccione una Sub Categoría"",""0"",""defauldSelected"");") & vbcrlf
					response.Write(vbtab & "f.subcategorias.options[" & J & "] = sub" & J & ";") & vbcrlf
					J = J + 1
					while not RSSubCategorias.eof
						subc_codigo = RSSubCategorias("codigo")
						subc_titulo = Apostrofe(RSSubCategorias("titulo"),0)
						response.Write(vbtab & "sub" & J & " = new Option(""" & subc_titulo & """,""" & subc_codigo & ""","""");") & vbcrlf
						response.Write(vbtab & "f.subcategorias.options[" & J & "] = sub" & J & ";") & vbcrlf
						J = J + 1
						RSSubCategorias.movenext
					wend
						
					response.Write("}") & vbcrlf
					
					I = I + 1
					RSCategorias.movenext
				wend
			
				RSCategorias.movefirst
			end if
%>
		} else {
			f.subcategorias.options.length = 0;
			sub0 = new Option("Seleccione una Sub Categoría","0","defauldSelected");
			f.subcategorias.options[0] = sub0;
		}
	}
</script>

<form name="form1" method="post" action="">

<select name="categorias" id="categorias" onChange="cambiarcategoria(this.value)">
<%
	if modo = "agregar" then response.Write("<option value=""0"">Seleccione una Categoría</option>")
	while not RSCategorias.eof
		if RSCategorias("codigo") = categoria then
			response.Write("<option value=""" & RSCategorias("codigo") & """ selected>" & Apostrofe(RSCategorias("titulo"),0) & "</option>")
		else
			response.Write("<option value=""" & RSCategorias("codigo") & """>" & Apostrofe(RSCategorias("titulo"),0) & "</option>")
		end if
		RSCategorias.movenext
	wend
%>
</select>

<select name="subcategorias" id="subcategorias">
	<option value="0">Seleccione una Sub Categoría</option>
</select>

</form>
__________________
Saruman

One Ring to rule them all, One Ring to find them, One Ring to bring them all and in the darkness bind them.