如何操作iframe父页面中的元素、方法、变量

方法 1. 在iframe中查找父页面元素的方法: jQuery的方法:$("#id",window.parent.document) 原生的方法:window.parent.document.getElementById("id"); //有时候iframe会嵌套好几层,那么嵌套两层时就是: window.parent.parent.document.getElementById("id");
相关文章
相关标签/搜索