当前位置: 代码迷 >> Web前端 >> 判断 iframe 是不是加载完成
  详细解决方案

判断 iframe 是不是加载完成

热度:540   发布时间:2012-11-08 08:48:11.0
判断 iframe 是否加载完成
var iframe = document.createElement("iframe");
iframe.src = "http://www.planabc.net";

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);


http://www.nczonline.net/blog/2009/09/15/iframes-onload-and-documentdomain/
http://msdn.microsoft.com/en-us/library/cc197055%28VS.85%29.aspx
1 楼 binlaniua 2010-10-07  
addEventListener ??如果用FF那么onload事件岂不是被你给覆盖掉了啊
  相关解决方案