根据内容调整大小的iFrame高度 [英] Resize iFrame height according to content

查看:282
本文介绍了根据内容调整大小的iFrame高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我也有这反过来加载其他页面的iframe的弹出页面。

I have a popup page which has an iframe which in turn loads another page.


 
 

我要调整iframe高度依赖于网页的加载它的大小。

I want to resize the iframe height depending on the size of page loaded in it.

推荐答案

的简单方法之一使用javascript:

one of the easy way is using javascript:

<script language="JavaScript">
  function autoResize(id){
  var newheight;
  var newwidth;

  if(document.getElementById){
    newheight=document.getElementById(id).contentWindow.document .body.scrollHeight;
    newwidth=document.getElementById(id).contentWindow.document .body.scrollWidth;
  }

  document.getElementById(id).height= (newheight) + "px";
  document.getElementById(id).width= (newwidth) + "px";
}
</script>

<IFRAME SRC="Iframef/iframep.aspx" width="100%" height="200px" id="iframe1" marginheight="0" frameborder="0" onLoad="autoResize('iframe1');"></iframe>

这篇关于根据内容调整大小的iFrame高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆