jquery子窗体操作父窗体中的元素

1.在父窗口中操作子窗口中的元素,如(其中 iframe1是iframe的ID) 1) 选中IFRAME中的所有单选钮   $(window.frames["iframe1"].document).find("input[@type='radio']").attr("checked","true"); 2).去掉子窗口中类名为top_menu元素的css属性类on $(window.frames["iframe1"].document).find('.top_menu').removeClass("on");
2.在IFRAME中操作父窗口的元素 1) 选中父窗口中的所有单选钮 $(window.parent.document).find("input[@type='radio']").attr("checked","true"); 2父窗口元素ID为_M1408加上CSS类on $(window.parent.document).find("#_M1408").addClass("on");
iframe框架的:<iframe src="http://chenxinwen2006.blog.163.com/blog/test.html" id="iframe1" width="700" height="300" frameborder="0" scrolling="auto"></iframe>
好像也可以用$("#myid", top.document);

 
父窗体调用IFrame中的方法(right)为ifram的id
document.frames["right"].expand(); 
父窗体:parent;

子窗体:opener;(window.opener.reload();)

 

$(window.parent.document).find("#alimamaifrm").attr("src","http://www.163.com");

原文地址:https://www.cnblogs.com/zxktxj/p/2563451.html