iframe大小控制方法
1
//js函数iframe的高度自动根据引用页面的高度变化
2
<script type="text/javascript">
3
function SetWinHeight(obj)
4
{
5
var win=obj;
6
if (document.getElementById)
7
{
8
if (win && !window.opera)
9
{
10
if (win.contentDocument && win.contentDocument.body.offsetHeight)
11
win.style.height = win.contentDocument.body.offsetHeight;
12
else if(win.Document && win.Document.body.scrollHeight)
13
win.style.height = win.Document.body.scrollHeight;
14
}
15![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
16
}
17
}
18![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
19
//引用
20
<iframe width="100%" frameborder="0" id="ifr" name="ifr" src="mindex.html" onload="SetWinHeight(this)" scrolling="no"></iframe>
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
2
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
3
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
4
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
5
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
6
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
7
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
8
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
9
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
10
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
11
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
12
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
13
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
14
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
15
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
16
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
17
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif)
18
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
19
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
20
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
0
0
(请您对文章做出评价)