您的位置:首页 > Web前端 > JQuery

JQuery跨Iframe选择实现代码

2010-08-19 00:00 525 查看
从父页面中选择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="test.html" id="iframe1" width="700" height="300" frameborder="0" scrolling="auto"></iframe>

IE7中测试通过
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: