JQuery跨Iframe选择实现代码
(编辑:jimmy 日期: 2025/5/11 浏览:3 次 )
从父页面中选择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框架的:<iframe src="/UploadFiles/2021-04-02/test.html">
IE7中测试通过
复制代码 代码如下:
$('#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框架的:<iframe src="/UploadFiles/2021-04-02/test.html">
IE7中测试通过
下一篇:JQuery中each()的使用方法说明