2012-08-22 17 views

risposta

1

Questo è un problema con IE. Sto usando seguendo come soluzione.

function dodisable() { 
    var b1=document.getElementById('B1'); 
    b1.value='Please Wait....'; 
    b1.disabled=true; 
    document.getElementById("browse").src = "hhhh.pdf"; /*LINK TO YOUR PDF*/ 
    setTimeout(URLoader_Timeout, 100); 
} 

function doenable() { 
    var b1=document.getElementById('B1'); 
    b1.value='Submit'; 
    b1.disabled=false; 
} 

function URLoader_Timeout() { 
    if (document.getElementById("browse").readyState == "complete") 
     doenable(); 
    else 
     setTimeout(URLoader_Timeout ,100); 
} 

HTML

<input type="button" name="B1" id="B1" value="Go" onclick="dodisable();" /> 
<iframe id="browse" onload="return doenable();" style="width:100%;height:100%"></iframe> 
8

Secondo il W3C, il tag iframe non supporta gli attributi di evento. Anche se i principali browser lo supportano ma non possono essere considerati affidabili. Se vuoi davvero provare questa soluzione alternativa. Puoi provare qualcosa di simile.

setTimeout(function(){ 
    if($('#FrameForPrintVersion').contents().find('*')!='undefined') { 
     alert('your frame loaded'); 
    } 
},200) 
+0

@aiiak Questa risposta deve essere contrassegnata come quella corretta! Inoltre, suppongo che potresti usare 'setInterval()' e 'clearInterval()' come approccio alternativo per l'aggiornamento di un iFrame in cui la connessione è lenta o i dati di risposta sono grandi. – RZet