您的位置:首页 > 其它

iframe实现自适应高度

2010-09-06 12:31 218 查看
<script type ="text/javascript" language ="javascript" >

<!--

function TuneHeight(fm_name,fm_id){

var frm=document.getElementById(fm_id);

var subWeb=document.frames?document.frames[fm_name].document:frm.contentDocument;

if (frm != null && subWeb != null){

frm.style.height = subWeb.documentElement.scrollHeight+ "px" ;

//如需自适应宽高,去除下行的“//”注释即可

// frm.style.width = subWeb.documentElement.scrollWidth+"px";

}

}

//-->

</script>

<iframe

onLoad ="{TuneHeight('FM_Name','FM_Id');}"

src ="http://www.3netgo.com" name ="FM_Name"

id ="FM_Id" width ="800" marginwidth ="0"

marginheight ="0"

frameborder ="0" scrolling ="no" >

</iframe>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: