Visualizzazione dei risultati da 1 a 2 su 2
  1. #1
    Utente di HTML.it
    Registrato dal
    May 2006
    Messaggi
    86

    Iframe accesso al document, problemi.

    Salve a tutti, e buonagiornata. Oggi ho un problema con l'accesso al document di un Iframe. Su FF gira benissimo, su ie no comunque vado ad esplicare il codice spero qualcuno possa aiutarmi. Già quando vado a leggere l'altezza del body del mio IFRAME me ne da una imprecisa ma quando vado a a precisare l'evento onclick sul document dell'Iframe non succede nulla. Ecco il codice:

    codice:
    <iframe id="iframe1" src="mioURL" scrolling="no" marginwidth="0" marginheight="0" frameborder="0">Il tuo browser non supporta questa applicazione</iframe>
    
    <script type="text/javascript">
    	this.iframe1 = document.getElementById("iframe1");
    	this.watchH;
    
    	iframe1.onload = function(){
    		var iframe1C = iframe1.document || iframe1.contentDocument;
    		var iframeH = iframe1C.body.offsetHeight;
    		iframe1.style.height = iframeH+"px";
    		iframe1.style.width = "100%";
    		watchH = iframe1C.body.offsetHeight;
    		iframe1C.onclick = function(){
    			if(iframe1C.body.offsetHeight != watchH){
    				iframeH = iframe1C.body.offsetHeight;
    				iframe1.style.height = iframeH+"px";
    			}
    		}
    	}
    </script>

  2. #2
    Utente di HTML.it
    Registrato dal
    May 2006
    Messaggi
    86
    do io la risposta in caso che explorer non digerisca il nostro contentDocument noi possiamo tranquillamente somministrargli questa:

    iframe1.contentWindow.document


    ROXA AMICI, A PRESTO

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.