<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>iframe的自动适应高度</title>
</head>
<body>
<script type="text/javascript">
function SetCwinHeight(o){
if (document.getElementById){
if (o && !window.opera){
if (o.contentDocument && o.contentDocument.body.offsetHeight){
o.height = o.contentDocument.body.offsetHeight;
}else if(o.Document && o.Document.body.scrollHeight){
o.height = o.Document.body.scrollHeight;
}
}
}
}
</script>
<iframe width="100%" id="o" οnlοad="Javascript:SetCwinHeight(this)" height="1" frameborder="0" src="IFrame_myPage.aspx"></iframe>
这是内容及其它
</body>
</html>
iframe自适应父窗口高度改变兼容IE firefox
最新推荐文章于 2024-11-05 15:26:40 发布