Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Olá pessoal, no iframe abaixo, preciso que ele apenas seja mostrado quando eu clicar em um botão qualquer. Como faço isso?
<div>
<iframe
width="1100"
height="500"
id="iframe"
src="[https://www.google.com.br"](https://www.google.com.br)
scrolling="no"
>
</iframe>
</div>Seria algo como abaixo?
<script type="text/javascript">
function abreIframe(){
document.getElementById('Iframe').style.display="block";
document.getElementById('buttonAbre').style.display="none";
document.getElementById('buttonFecha').style.display="block";
}
function fechaIframe(){
document.getElementById('Iframe').style.display="none";
document.getElementById('buttonAbre').style.display="block";
document.getElementById('buttonFecha').style.display="none";
}
</script>
<button id="buttonAbre" style="display:block" onclick="abreIframe()">Abrir Iframe</button>
<button id="buttonFecha" style="display:none" onclick="fechaIframe()">Fechar Iframe</button>
<div id="Iframe" style="display:none"><iframe width='960' height='500' id='iframe' src='https://www.google.com.br' scrolling='no'></iframe></div>
Não entendi muito bem mas;
veja se algo do tipo te ajuda.
http://getbootstrap.com/javascript/#modals-related-target