var iframe = document.createElement("iframe");
iframe.src = "http://www.cnblogs.com/lifeil/";
if (!/*@cc_on!@*/0) { //if not IE
iframe.onload = function(){
alert("框架加載完畢.");
};
} else {
iframe.onreadystatechange = function(){
if (iframe.readyState == "complete"){
alert("框架加載完畢.");
}
};
}
document.body.appendChild(iframe);後來有個牛人找到了如下更完美的處理方法:
var iframe = document.createElement("iframe");
iframe.src = "http://www.cnblogs.com/lifeil/";
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);
轉自: https://www.cnblogs.com/wangxiong/archive/2013/05/29/3107218.html