jquery iframe 获取父级

1.在父窗口中获取指定iframe(testiframe)id为testid的class

$(window.frames["testiframe"].document).find("#testid").attr('class');

2.在IFRAME中获取父窗口中id为testid的class

$(window.parent.document).find("#testid").attr('class');

iframe框架的:

<iframesrc="test.html"id="testiframe"width="700"height="300"frameborder="0"scrolling="auto"></iframe>

相关推荐