Javascript 检测iframe是否加载完毕
阅读(3218)不用专门针对IE使用onreadystatechange的检测方式,直接食用onload的检测就好了。
var iframe = document.createElement("iframe");
iframe.src = "simpleinner.htm";
if (iframe.attachEvent){
iframe.attachEvent("onload", function(){
alert("Local iframe is now loaded.");
});
} else {
iframe.onload = function(){
alert("Local iframe is now loaded.");
};
}
document.body.appendChild(iframe);
via: http://www.nczonline.net/blog/2009/09/15/iframes-onload-and-documentdomain/
参考: http://msdn.microsoft.com/en-us/library/cc197055(VS.85).aspx