The Iframe automatically ADAPTS to the height of the page's sample code

  • 2020-03-30 02:09:24
  • OfStack

 
function SetCwinHeight(obj) { 
var cwin = obj; 
if (document.getElementById) { 
if (cwin && !window.opera) { 
if (cwin.contentDocument && cwin.contentDocument.body.offsetHeight) 
cwin.height = cwin.contentDocument.body.offsetHeight + 30; 
else if (cwin.Document && cwin.Document.body.scrollHeight) 
cwin.height = cwin.Document.body.scrollHeight + 30; 
} 
} 
} 

 
<iframe id="IframeId_help" scrolling="no" onload="Javascript:SetCwinHeight(this)" 
width="670px" style="border: 0px" frameborder="0"></iframe> 


Related articles: