How to obtain the height of the content in iframe and open the height of the parent container

the iframe height on the top of the page does not stretch with the content height, resulting in multiple scroll bars on the page

Mar.04,2022

https://blog.csdn.net/qq_3060.


1. Give the current iframe a min-height;
2, and then js controls the height for adaptive layout, as follows:

function setIframeHeight(iframe) {
  if (iframe) {
    var iframeWin = iframe.contentWindow || iframe.contentDocument.parentWindow;
    if (iframeWin.document.body) {
      iframe.height = iframeWin.document.documentElement.scrollHeight || iframeWin.document.body.scrollHeight;
    }
  }
};
window.onload = function () {
  setIframeHeight(document.getElementById('-sharpID'));// -sharpIDiframeid
};
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3bbd3-4d957.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3bbd3-4d957.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?