您的位置:首页 > 其它

iframe子页面获取父页面元素的方法

2015-02-10 17:53 225 查看
/article/1251220.html

/article/7080436.html

1、在父窗口中获取iframe中的元素

格式:window.frames["iframe的name值"].document.getElementById("iframe中控件的ID").click();

实例:window.frames["ifm"].document.getElementById("btnOk")

2.获取父元素:

$.('#objld', parent.document);

在父页面获取iframe子页面的元素 :

$("#objid", document.iframes('iframe').document) (这种方法不能使用)



$(document.getElementById('iframeId').contentWindow.document.body).html() $(document.getElementById('iframeId').contentWindow.document.body).html()
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: