判断iframe加载完成

来源:互联网 发布:数显式推拉力计淘宝 编辑:程序博客网 时间:2024/04/29 02:52

方法一:

if (!/*@cc_on!@*/0) { //if not IE    iframe.onload = function(){        alert("Local iframe is now loaded.");    };} else {    iframe.onreadystatechange = function(){        if (iframe.readyState == "complete"){            alert("Local iframe is now loaded.");        }    };}
方法二:

if (iframe.attachEvent){    iframe.attachEvent("onload", function(){        alert("Local iframe is now loaded.");    });} else {    iframe.onload = function(){        alert("Local iframe is now loaded.");    };}

原创粉丝点击