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> 

posted on 2009-10-28 16:02  trance  阅读(302)  评论(0编辑  收藏  举报

导航