by1455的自留地

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

在主程序中用以下javascript

 

 function calcIFrameHeight(id) {
           
          //find the height of the internal page
          var theHeight=
            document.getElementById(id).contentWindow.
              document.body.scrollHeight;
 
          //change the height of the iframe
          document.getElementById(id).height =
              theHeight + 50;
        }

 

在iframe中用

if (this.frameElement != null) window.parent.calcIFrameHeight(this.frameElement.attributes.id.value);

 

 

posted on 2011-09-22 10:26  by1455  阅读(250)  评论(0编辑  收藏  举报