posts - 710,  comments - 81,  views - 260万
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

1>父窗口获取子窗口

js方法

document.getElementById('if1').contentWindow.document;

window.frames["if1"].document.body;

jQuery方法

$(this).contents();

2>父窗口获取子窗口高度

js方法

document.getElementById('if1').contentWindow.document.body.scrollHeight;

window.frames["if1"].document.body.scrollHeight;

jQuery方法

$(this).contents()[0].body.scrollHeight;

3>子窗口调用父窗口方法

js方法

window.parent.fun();

4>iframe自适应高度

在iframe的load事件中重新设置iframe的高度。

  

 程序员的基础教程:菜鸟程序员

posted on   itprobie-菜鸟程序员  阅读(380)  评论(0编辑  收藏  举报
点击右上角即可分享
微信分享提示