Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

thi.ASP

Combo Dinamico

Recommended Posts

pessoal, alguem tem algum código de combo dinamico?

 

No estilo Estado e Cidade... em um combo a pessoa seleciona o Estado (enqto no outro fica vazio) depois q ela seleciona o Estado no outro de Cidade são listadas as respectivas Cidades daquele estado, e se trocar de estado continua alterando as cidades... mas detalhe... sem o REFRESH!!! tem um desse estilo no site do cinemark [ http://www.cinemark.com.br ] q ao mudar a cidade ele lista os cinemas dakela cidade....

 

Espero que alguem me ajudeeeeeeeeeeeeeeeeeeeeeeee

Compartilhar este post


Link para o post
Compartilhar em outros sites

esse codigo na pagina do combo:

 

<script>

 

function carregar1(){

var url;

url = 'remote.asp?id='+document.Frm_grava.select_grupo[document.Frm_grava.select_grupo.selectedInd

ex].value;

document.Frm_grava.select_motivo.options.length = 0;

addItem(document.Frm_grava.select_motivo,"Aguarde...carregando","",false,document.Frm_grava.select_motivo.length)

myIframe.location = url;

document.Frm_grava.select_motivo.focus()

 

}

 

function inicia1(){

local1 = new Array();

var maximo1, i, campo1;

local1 = myIframe.loc;

campo1 = document.Frm_grava.select_motivo;

maximo1 = local1.length;

document.Emendas.cboLOC.options.length = 0;

addItem(campo1,'','',false,campo1.length);

for (i=0;i<maximo1;i++){

addItem(campo1,local1[1],local1[0],false,campo1.length);

}

}

function addItem(obj,strText,strValue,blSel,intPos){

var newOpt,i,ArTemp,selIndex;

selIndex = (blSel)?intPos:obj.selectedIndex;

newOpt = new Option(strText,strValue);

Len = obj.options.length+1

if (intPos > Len) return

obj.options.length = Len

if (intPos != Len) {

ArTemp = new Array();

for(i=intPos;i<obj.options.length-1;i++)

ArTemp = Array(obj.options.text,obj.options.value);

for(i=intPos+1;i<Len;i++)

obj.options = new Option(ArTemp[i-1][0],ArTemp[i-1][1]);

}

obj.options[intPos] = newOpt;

if (selIndex > intPos)

obj.selectedIndex = selIndex+1;

else if (selIndex == intPos)

obj.selectedIndex = intPos;

}

 

</script>

 

<select name="select_grupo" class="TextBox" onchange="carregar1()">

<option value="000" selected></option>

<%

while not conexao.eof%>

<option value="<%response.write conexao("cod_grupo")%>"> <b><font face="Verdana, Arial, Helvetica, sans-serif" size="2">

<%response.write mid(conexao("txt_desc_grupo"),1,40)%>

</font></b></option>

<%

conexao.movenext

wend

%>

</select>

Compartilhar este post


Link para o post
Compartilhar em outros sites

você criar uma pagina remote.asp, com as devidas conexões ao banco e insere esse codigo:<html> <head><title></title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><script language="JavaScript"> function carregaMot(){ var a=1; parent.document.Frm_grava.select_motivo.length=0; parent.document.Frm_grava.select_motivo.options[0]=new Option('Selecione_________',000000); <%while not rs1.EOF%> var oOption = parent.document.createElement("OPTION"); parent.document.Frm_grava.select_motivo.options[a]=new Option('<%=rs1("txt_desc_motivo")%>',<%=rs1("cod_motivo")%>); a=a+1; <%rs1.MoveNext%> <%wend%> <%rs1.close%> <%set rs1=Nothing%> <%set dbConn=Nothing%> }</script></head><body onLoad="carregaMot()"></body> </html>

Compartilhar este post


Link para o post
Compartilhar em outros sites

faltou esse codigo na pagina do combo:<IFRAME src name="myIframe" id="myIframe" width="0" height="0" marginwidth="0" marginheight="0"><!--webbot BOT="HTMLMarkup" endspan --><!--webbot bot="HTMLMarkup" TAG="XBOT" StartSpan --></IFRAME><!--webbot BOT="HTMLMarkup" endspan -->

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.