iframe 自适应高度

<script>

window.onload = function (){
    
    var isIE = navigator.userAgent.toUpperCase().indexOf("MSIE")==-1?false:true;
    if(isIE){
        parent.document.getElementById("lesson_list").style.height = document.body.scrollHeight; 
    } else {
        parent.document.getElementById("lesson_list").style.height = document.documentElement.offsetHeight + 'px'; 
    }
    
}

</script>

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

 

<iframe id="lesson_list" width="100%" scrolling="no" height="172" frameborder="0" onload="this.height=lesson_list.document.body.scrollHeight" name="lesson_list" src="/edu/iframe_lesson_list.php" style="">

 

posted @ 2013-04-18 15:20  熙陌陌BKY  阅读(75)  评论(0)    收藏  举报