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框架的:
<iframe src="test.html" id="testiframe" width="700" height="300" frameborder="0" scrolling="auto"></iframe>
$(window.frames["testiframe"].document).find("#testid").attr('class');
2.在IFRAME中获取父窗口中id为testid的class
$(window.parent.document).find("#testid").attr('class');
iframe框架的:
<iframe src="test.html" id="testiframe" width="700" height="300" frameborder="0" scrolling="auto"></iframe>
本文详细介绍了如何在父窗口中和iframe中获取指定元素的class属性,包括使用JavaScript操作DOM的方法。
645

被折叠的 条评论
为什么被折叠?



