Home  >  Article  >  Web Front-end  >  JQuery跨Iframe选择实现代码_jquery

JQuery跨Iframe选择实现代码_jquery

WBOY
WBOYOriginal
2016-05-16 18:21:10859browse

从父页面中选择iframe中的元素:

复制代码 代码如下:

$('#btnCancel',$('#PopFrame')[0].contentWindow.document)


从iframe页面中选择父页面中的元素:
复制代码 代码如下:

$("#PopContainer",parent.document)

以下内容是别的网友的解决方法:
只好用DOM方法与jquery方法结合的方式实现了

1.在父窗口中操作 选中IFRAME中的所有单选钮
$(window.frames["iframe1"].document).find("input[@type='radio']").attr("checked","true");

2.在IFRAME中操作 选中父窗口中的所有单选钮
$(window.parent.document).find("input[@type='radio']").attr("checked","true");

iframe框架的:

IE7中测试通过
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn