from http://www.planabc.net/2009/09/22/iframe_onload/app
1 var iframe = document.createElement("iframe"); 2 iframe.src = "http://www.planabc.net"; 3 4 if (iframe.attachEvent){ // for ie 5 iframe.attachEvent("onload", function(){ 6 alert("Local iframe is now loaded."); 7 }); 8 } else { 9 iframe.onload = function(){ 10 alert("Local iframe is now loaded."); 11 }; 12 } 13 14 document.body.appendChild(iframe);
IE 支持 iframe 的 onload 事件,不過是隱形的,須要經過 attachEvent 來註冊。spa