Javascript iframe onload函数在IE中不工作
它在FF中可以正常工作,但在IE中不能使用iframe.onload。你有没有试过类似的东西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
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);