Veja o Exemplo isso é um LINKObservem q já consegui fazer o preencimento da combo do jeito q eu queria, porem surgui outra dúvida.
Selecione Reltótio 1 por exemplo e clike no "link2" irá preencher a combo na boa, porem ao voltar para o "link1" ele mantem a selec. To tentando fazer ela sumir mas ñ consigo.
abaixo o Código<html>
<head>
<title>Eu sou xxxxxx!</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script>
function exibeTab(tabEsconder1, tabEsconder2, tabMostrar){
/*alert(tabEsconder1.style.display);
alert(tabEsconder2);
alert(tabMostrar.style.display);*/
vTipoRel = document.all.tipoRelatorio.options.value;
//alert(vTipoRel);
if(vTipoRel==""){
alert("Selecione um tipo de relatório");
document.all.tipoRelatorio.focus();
}else{
tabEsconder1.style.display = 'none';
tabEsconder2.style.display = 'none';
tabMostrar.style.display = 'block';
//document.all.auxTipoRel.value = vTipoRel;
switch (vTipoRel) {
case "Rel1" :
document.getElementById("_Campos_Rel_sel").options.length = 0;
//valor 1
valor = document.createElement ("option"); // Cria elemento VALUE vazio
valor.setAttribute ("value", "Razão Social"); // atribui um valor para o elemento VALUE
rotulo = document.createTextNode("Razão Social"); // Cria elemento ROTULO vazio
valor.appendChild (rotulo); // atribui um valor para o elemento ROTULO
document.getElementById("_Campos_Rel_sel").appendChild (valor); //adicio o elemento VALUE e ROTULO na Select desejada
valor = document.createElement ("option");
valor.setAttribute ("value", "Nome Fantasia");
rotulo = document.createTextNode("Nome Fantasia");
valor.appendChild (rotulo);
document.getElementById("_Campos_Rel_sel").appendChild (valor);
valor = document.createElement ("option");
valor.setAttribute ("value", "CNPJ");
rotulo = document.createTextNode("CNPJ");
valor.appendChild (rotulo);
document.getElementById("_Campos_Rel_sel").appendChild (valor);
//document.all._Campos_Rel_sel.style.display='none';
break;
case "Rel2" :
document.getElementById("_Campos_Rel_sel").options.length = 0;
valor = document.createElement ("option");
valor.setAttribute ("value", "Nome");
rotulo = document.createTextNode("Nome");
valor.appendChild (rotulo);
document.getElementById("_Campos_Rel_sel").appendChild (valor);
valor = document.createElement ("option");
valor.setAttribute ("value", "Telefones");
rotulo = document.createTextNode("Telefones");
valor.appendChild (rotulo);
document.getElementById("_Campos_Rel_sel").appendChild (valor);
valor = document.createElement ("option");
valor.setAttribute ("value", "E-mail");
rotulo = document.createTextNode("E-mail");
valor.appendChild (rotulo);
document.getElementById("_Campos_Rel_sel").appendChild (valor);
break;
case "Rel3" :
document.getElementById("_Campos_Rel_sel").options.length = 0;
valor = document.createElement ("option");
valor.setAttribute ("value", "Agente");
rotulo = document.createTextNode("Agente");
valor.appendChild (rotulo);
document.getElementById("_Campos_Rel_sel").appendChild (valor);
valor = document.createElement ("option");
valor.setAttribute ("value", "Vendedor");
rotulo = document.createTextNode("Vendedor");
valor.appendChild (rotulo);
document.getElementById("_Campos_Rel_sel").appendChild (valor);
valor = document.createElement ("option");
valor.setAttribute ("value", "Cliente");
rotulo = document.createTextNode("Cliente");
valor.appendChild (rotulo);
document.getElementById("_Campos_Rel_sel").appendChild (valor);
break;
}//Fim Break
}//fim if
}// fim function
</script>
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="40" bgcolor="#EEEEEE">
<h3 align="center"><strong>[
<a href="#" onClick="exibeTab(document.all.tbl2, document.all.tbl3, document.all.tbl1);">Íten 1</a> |
<a href="#" onClick="exibeTab(document.all.tbl1, document.all.tbl3, document.all.tbl2);">Íten 2</a> |
<a href="#" onClick="exibeTab(document.all.tbl1, document.all.tbl2, document.all.tbl3);">Íten 3</a>
]</strong></h3>
</td>
</tr>
<tr>
<td height="100"><form action="" method="post" name="f_teste" id="f_teste">
<table width="80%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#000000" id="tbl1" rules="groups">
<tr>
<td colspan="2"><strong>TABELA 1</strong></td>
</tr>
<tr>
<td width="12%"><em><font color="#FF0000">Select 1:</font></em></td>
<td width="88%">
<select name="tipoRelatorio" id="tipoRelatorio">
<!--<option selected>-- Selecione um Relatório --</option>-->
<option value="Rel1">Relatório 1</option>
<option value="Rel2">Relatório 2</option>
<option value="Rel3">Relatório 3</option>
</select>
</td>
</tr>
</table>
<table width="80%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#000000" id="tbl2" rules="groups" style="display:none;">
<tr>
<td colspan="3"><strong>TABELA 2</strong></td>
</tr>
<tr align="center">
<td width="46%"> </td>
<td width="4%"> </td>
<td width="50%"><select name="_Campos_Rel_sel" size="5" multiple id="_Campos_Rel_sel" style="width:350">
</select></td>
</tr>
</table>
<table width="80%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#000000" id="tbl3" rules="groups" style="display:none;">
<tr>
<td colspan="3"><strong>TABELA 3</strong></td>
</tr>
<tr align="center">
<td width="46%">
<select name="_Campos_Rel_Ord_disp" size="5" multiple id="_Campos_Rel_Ord_disp" style="width:350">
</select>
</td>
<td width="4%"> </td>
<td width="50%"> </td>
</tr>
</table>
</form></td>
</tr>
</table>
</body>
</html>
Edição feita por: calcio, 11/08/2005, 15:31.