var iframe = document.createElement("iframe");iframe.style.width = "265px";iframe.style.height = "490px";iframe.style.border = "none";iframe.src = "http://cnblogs.com/walls"; if(iframe.attachEvent){ //IE iframe.attachEvent("onload", function(){ alert("loaded 1"); });}else{ iframe.onload = function(){ console.log("loaded 2"); };}
- IE 支持 iframe 的 onload 事件,不过是隐形的,需要通过 attachEvent 来注册。
时间: 2024-12-24 19:58:51