Div oculta
Boa tarde a todos. Direto ao ponto. Pessoal gostaria que a divA e divB de inicio quando teclamos (F12) para visualizar na tela FICASSE OCULTA e
ao selecionar o itemA exibisse a divA ou
ao selecionar o itemB exibisse a divB
<select id="idSelect" onChange="mudarEstado();">
<option value="">--selecione--</option>
<option value="valueA" >itemA</option>
<option value="valueB" >itemB</option>
</select>
<br />
<div id="palco">
<div id="divA">exibe div A</div>
<div id="divB">exibe div B</div>
</div>
<script type="text/javascript">
function mudarEstado() {
var forIgual = document.getElementById("idSelect").value;
if (forIgual === "valueA"){
document.getElementById("divA").style.display = "block";
document.getElementById("divB").style.display = "none";
}
else if (forIgual === "valueB"){
document.getElementById("divA").style.display = "none";
document.getElementById("divB").style.display = "block";
}
}
</script>Discussão (4)
Carregando comentários...