让我们一起爱米兰
站内搜搜:
移动设备
请扫描二维码
或访问
m.milan100.com
您所在的位置 -> 米兰百分百 -> jquery -> jquery 操作iframe

jquery 操作iframe

点击数:1849 发表时间:2010-06-03 15:34:32 作者: 来源链接:
分享到:
分享到微信

没找到很好的方法
只好用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中测试通过 回去你自己试试吧
刚才google到的,补充一下

I beat my head against this wall for quite some time.

Try this:
$("#myid", top.document);
the top.document tells the selector to target the myid element which
exists in the topmost document (your parent page).  In order for this
to work, jquery must be loaded in the file which is viewed through the
iframe.

我的代码
$('#parentElem', top.document).append('');

 

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

那选择id自然就是依然使用find方法
$(window.frames["iframe1"].document).find("#id")

实际楼上上的方法本质上在Jq内部也是调用了find方法
 
父窗体调用IFrame中的方法(right)为ifram的id
document.frames["right"].expand();  
父窗体:parent;
子窗体:opener;(window.opener.reload();)
2
很 好
2
一 般
2
差 劲
热门新闻
相关文章
上一篇: jQuery获取Select选择的Text和 Value(转)
下一篇:
评论区
匿名

返回首页 | 收藏本页 | 回到顶部
Copyright 2010. 米兰百分百 Powered By Bridge.
京ICP备15050557号