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");

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章