本文摘自PHP中文网,作者coldplay.xixi,侵删。
jquery 判断iframe是否加载完成的方法:1、使用【jQuery load()】方法;2、使用【onreadystatechange】方法;3、使用【attachEvent】方法。

本教程操作环境:windows7系统、jquery3.2.1版本,该方法适用于所有品牌电脑。
jquery 判断iframe是否加载完成的方法:
方法一、jQuery load()
1 2 3 4 | var frm = document.getElementById('myiframe');
$(frm).load(function(){
dosomething();
});
|
方法二、onreadystatechange
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | var iframe = document.createElement("myiframe");
iframe.src = "http://www.baidu.com";
if (!0) {
iframe.onload = function(){
alert("Local iframe is now loaded.");
};
} else {
iframe.onreadystatechange = function(){
if (iframe.readyState == "complete"){
alert("Local iframe is now loaded.");
}
};
}
document.body.appendChild(iframe);
|
方法三、attachEvent
阅读剩余部分
相关阅读 >>
jQuery有哪些表单选择器
live jQuery 不支持吗
怎么看网页是不是加载jQuery
怎么解决jQuery ajax失败问题
浅谈jQuery中的each方法
使用jQuery实现网站导航抖动效果
jQuery怎么删除select中的选项
基于jQuery开发的ui框架有哪些
jQuery判断checkbox是否被选中的方法
jQuery如何使用正则
更多相关阅读请进入《jQuery》频道 >>
人民邮电出版社
本书对 Vue.js 3 技术细节的分析非常可靠,对于需要深入理解 Vue.js 3 的用户会有很大的帮助。——尤雨溪,Vue.js作者
转载请注明出处:木庄网络博客 » jquery 如何判断iframe是否加载完成