iframe 自适应高度

iframe 的高度自适应,常用的功能

< iframe  name ="detl"  id ="detl"  src ="list0.html"  scrolling ="no"  frameborder ="0"  width ="100%"  height ="auto"  onload ="Javascript:SetWinHeight(this)"   ></ iframe >
        
< div  class ="space10" >   < script  type ="text/javascript" >
      
function  SetWinHeight(obj)
        {
        
var  win = obj;
        
if  (document.getElementById)
        {
               
if  (win  &&   ! window.opera)
               {
                
if  (win.contentDocument  &&  win.contentDocument.body.offsetHeight)
        
                 win.height 
=  win.contentDocument.body.offsetHeight; 
                
else   if (win.Document  &&  win.Document.body.scrollHeight)
                 win.height 
=  win.Document.body.scrollHeight;
               }
        }
        }

      </script></div> 

你可能感兴趣的:(iframe)