判断 iframe 是否加载完成的完美方法
转自:http://www.planabc.net/2009/09/22/iframe_onload/最近, Nicholas C. Zakas 文章《Iframes, onload, and document.domain》的评论中 Christopher 提供了一个新的判断方法(很完美):
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);
页:
[1]