Ir para conteúdo

POWERED BY:

Arquivado

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

STHELT

2 funções

Recommended Posts

estou tentando executar 2 funções js mas apenas uma funciona...

ao clicar em aparecer a div com frame:

<HTML>
<HEAD>
 <script type="text/javascript">var div = "1";

 function AparecerDiv(){ // função aparecer
     document.getElementById(div).style.display = "block";

}
</script>
 <script type="text/javascript">var div = "2";

 function AparecerDiv2(){ // função aparecer
     document.getElementById(div).style.display = "block";

}
</script>

 
</HEAD>
<BODY>
<span onClick="AparecerDiv();" style="cursor: pointer;">botao 1</span>
<span onClick="AparecerDiv2();" style="cursor: pointer;">botao 2 </span>

<div id="1" style="display: none;">
<iframe src="http://orkut.com" width="100%" height="900" scrolling="no" frameborder="0"></iframe>
</div>
<div id="2" style="display: none;">
<iframe src="http://google.com" width="100%" height="900" scrolling="no" frameborder="0"></iframe>
</div>

o que esta errado?

Compartilhar este post


Link para o post
Compartilhar em outros sites

Bom dia STHELT, tudo bem?

 

seguinte, tenta fazer assim:

 

 <script type="text/javascript">var div = "1";

 function AparecerDiv(){ // função aparecer
     document.getElementById('div1').style.display = "block";

}
</script>
 <script type="text/javascript">var div = "2";

 function AparecerDiv2(){ // função aparecer
     document.getElementById('div2').style.display = "block";

}
</script>

.
.
.

<div id="div1" style="display: none;">
<iframe src="http://orkut.com" width="100%" height="900" scrolling="no" frameborder="0"></iframe>
</div>
<div id="div2" style="display: none;">
<iframe src="http://google.com" width="100%" height="900" scrolling="no" frameborder="0"></iframe>
</div>

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.