Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/379.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript iframe onload函数在IE中不工作_Javascript - Fatal编程技术网

Javascript iframe onload函数在IE中不工作

Javascript iframe onload函数在IE中不工作,javascript,Javascript,它在FF中可以正常工作,但在IE中不能使用iframe.onload。你有没有试过类似的东西 function showHotelbewertung(W3CElement, objCode) { var iframe = document.createElement("iframe"), img = document.createElement("img"); W3CElement.style.position = "relative" ifr

它在FF中可以正常工作,但在IE中不能使用iframe.onload。

你有没有试过类似的东西

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 = "position:absolute;top:15px;left:300px";
       W3CElement.appendChild(img);
}
frame.attachEvent('onload',function(){CustomFunction()})

什么版本的IE?相关的:
setTimeout(function() {
       iframe.onload = function() {
         //var height=iframe.contentWindow.document.body.scrollHeight;
         alert('');
         W3CElement.removeChild(img);
         iframe.style.cssText = "width:100%;height:400px";
       }
}, 0);