[JavaScript] iframe 高度自适应 →→→→→进入此内容的聊天室

来自 , 2020-07-19, 写在 JavaScript, 查看 193 次.
URL http://www.code666.cn/view/8bf1211f
  1. function iFrameHeight(id) {  
  2.  
  3.   var iframeid=document.getElementById(id); //iframe id
  4.   if (document.getElementById){
  5.    if (iframeid && !window.opera){
  6.     if (iframeid.contentDocument && iframeid.contentDocument.body.offsetHeight){
  7.      iframeid.height = iframeid.contentDocument.body.offsetHeight+ 100;
  8.     }else if(iframeid.Document && iframeid.Document.body.scrollHeight){
  9.      iframeid.height = iframeid.Document.body.scrollHeight+ 100;
  10.     }
  11.    }
  12.   }
  13. }
  14.  
  15.  
  16. <iframe src="http://www.baidu.com"  width="100%" height="200" frameborder="0" id="bao_cha_iframe" onLoad="iFrameHeight()"></iframe>

回复 "iframe 高度自适应"

这儿你可以回复上面这条便签

captcha