js iframe自适应高度

来源:互联网 发布:淘宝为什么被删除评价 编辑:程序博客网 时间:2024/05/17 09:32
function iFrameHeight() {
   var ifm= document.getElementById("gameifr");
   var subWeb = document.frames ? document.frames["gameifr"].document : ifm.contentDocument;
   if(ifm != null && subWeb != null) {
   ifm.height = subWeb.body.scrollHeight;
   }
  }