- $("body",parent.document).append('这是子级页面添加的内容!');
- $("body",parent.document).find('#example').html('子级页面将替换父级页面的内容!');
另外对于javascript操作iframe对象有几点需要说明的是:
iframe里的js要操作父级窗口的dom,必须搞懂几个对象:
parent是父窗口(如果窗口是顶级窗口,那么parent==self==top),
top是最顶级父窗口(有的窗口中套了好几层frameset或者iframe),
self是当前窗口(等价window),
opener是用open方法打开当前窗口的那个窗口;