上次给大家介绍了两种用jquery实现的方法,今天给大家介绍另一种方法。
<script
type="text/javascript">
//iframe 自适应高度
function SetCwinHeight(){
var bobo=document.getElementById("main"); //iframe id
if
(document.getElementById){
if (bobo && !window.opera){
if (bobo.contentDocument && bobo.contentDocument.body.offsetHeight){
bobo.height = bobo.contentDocument.body.offsetHeight;
}else if(bobo.Document && bobo.Document.body.scrollHeight){
bobo.height =
bobo.Document.body.scrollHeight+30;
//alert(document.getElementById("amdright").style.width);
}
}
}
}
</script>
<iframe width="99%" id="main" name="main" onload="SetCwinHeight()" frameborder="0" src="default.php" scrolling="no"></iframe>
相关文章

精彩导读
热门资讯
关注我们