Jump to content


GuhCoimbra

Member Since 09/04/2011
Offline Last Active 09/05/2011, 17:05
-----

Topics I've Started

Iframe Dinâmico

09/04/2011, 09:37

Olá pessoal!

Estou precisando de ajuda em um site com iframe de altura dinâmica + botão em flash.
Eu procurei bastante aqui no fórum mas não consegui achar nada semelhante.
Alguém pode me ajudar?

O que está acontecendo é o seguinte: eu tenho um menu em flash e uso esse código para navegação:
on(press){
getURL("queijostotal.html","principal")
}
Quando estou usando um script de iframe não dinâmico funciona tudo beleza.
Agora se eu coloco o script de iframe dinâmico as páginas abrem em uma aba separada do navegador.
O que será que está dando errado?
Vou colar aqui os sripts que estou usando, alguém consegue me ajudar?

Obrigado.

IFRAME DINAMICO
ISSO EU COLOCO NO HEAD NA PÁGINA PRINCIPAL:
<script type="text/javascript">

/***********************************************
* IFrame SSI script II- © Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
* Visit DynamicDrive.com for hundreds of original DHTML scripts
* This notice must stay intact for legal use
***********************************************/

//Insira os IDs dos IFRAMES que você deseja redimensionar dinamicamente para corresponder à altura de conteúdo:
//Separe cada ID com uma vírgula. Exemplos: ["myframe1", "myframe2"] ou ["myframe"] ou [] para nenhum:
var iframeids=["principal"]

//O script deve esconder o iframe dos navegadores que não suportam este script (não os navegadores IE5+/NS6+. Recomendado):
var iframehide="yes"

var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
var FFextraHeight=parseFloat(getFFVersion)>=0.1? 16 : 0 //altura extra em px para adicionar iframe nos navegadores FireFox 1.0 +

function resizeCaller() {
var dyniframe=new Array()
for (i=0; i<iframeids.length; i++){
if (document.getElementById)
resizeIframe(iframeids[i])
//mostrar iframe para navegadores mais inferiores? (veja o var acima)

if ((document.all || document.getElementById) && iframehide=="no"){
var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i])
tempobj.style.display="block"
}
}
}

function resizeIframe(frameid){
var currentfr=document.getElementById(frameid)
if (currentfr && !window.opera){
currentfr.style.display="block"
if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) //sintaxe ns6
currentfr.height = currentfr.contentDocument.body.offsetHeight+FFextraHeight;
else if (currentfr.Document && currentfr.Document.body.scrollHeight) //sintaxe ie5+
currentfr.height = currentfr.Document.body.scrollHeight;
if (currentfr.addEventListener)
currentfr.addEventListener("load", readjustIframe, false)
else if (currentfr.attachEvent){
currentfr.detachEvent("onload", readjustIframe) // Conserto de bug
currentfr.attachEvent("onload", readjustIframe)
}
}
}

function readjustIframe(loadevt) {
var crossevt=(window.event)? event : loadevt
var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement
if (iframeroot)
resizeIframe(iframeroot.id);
}

function loadintoIframe(iframeid, url){
if (document.getElementById)
document.getElementById(iframeid).src=url
}

if (window.addEventListener)
window.addEventListener("load", resizeCaller, false)
else if (window.attachEvent)
window.attachEvent("onload", resizeCaller)
else
window.onload=resizeCaller

</script>

ISSO EU COLOCO NO BODY:
<iframe id="principal" src="principal.html" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" vspace="0" hspace="0" style="overflow:visible; width:100%; display:none"></iframe></td>



IFRAME DE ALTURA FIXA - ESSE FUNCIONA CERTINHO
<iframe name="principal" frameborder="0" scrolling="auto" src="principal.html" width="950" height="5150" border="0" cellpadding="0" cellspacing="0"></iframe></td>


IPB Skin By Virteq