开发者

iframe onload function not working in IE

开发者 https://www.devze.com 2023-04-10 20:29 出处:网络
function showHotelbewertung(W3CElement, objCode) { var iframe = document.createElement(\"iframe\"), img = document.createElement(\"img\");
function showHotelbewertung(W3CElement, objCode) {
   var iframe = document.createElement("iframe"),
       img = document.createElement("img");

       W3CElement.style.position = "relative"

       iframe.className = "bewertung_iframe"  
       iframe.id = "bewertung_iframe"  
       iframe.src = "http://example.com&code="+objCode;
       W3CElement.appendChild(iframe);  

       iframe.onload = function() {
         //var height=iframe.contentWindow.document.body.scrollHeight;
         alert('')
         W3CElement.removeChild(img);
         iframe.style.cssText = "width:100%;height:400px";
       }

       img.src = "assets/images/loader.gif";
       img.style.cssText开发者_StackOverflow社区 = "position:absolute;top:15px;left:300px";
       W3CElement.appendChild(img);
}

it works fine in FF but iframe.onload does not in IE.


Have you ever been tried some thing like this?

setTimeout(function() {
       iframe.onload = function() {
         //var height=iframe.contentWindow.document.body.scrollHeight;
         alert('');
         W3CElement.removeChild(img);
         iframe.style.cssText = "width:100%;height:400px";
       }
}, 0);


frame.attachEvent('onload', function() { CustomFunction()});

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号