如何通过JS控制父级别框架可是高度
JS 控制框架高度自适应浏览器:
框架主页面代码如下:
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="8" bgcolor="#353c44">
</td>
<td width="191" valign="top">
<iframe height="100%" width="100%" border="0" frameborder="0" src="/Common/Left"
name="leftFrame" id="leftFrame" title="leftFrame"></iframe>
</td>
<td width="10" bgcolor="#fff">
</td>
<td valign="top">
<iframe width="100%" border="0" frameborder="0" src="/Common/SuppotMain" name="rightFrame"
id="rightFrame" title="rightFrame" overflow-y="auto" overflow-x="none"></iframe>
</td>
<td width="8" bgcolor="#353c44">
</td>
</tr>
</table>
</body>
<script>
function resize() {
$("#rightFrame", window.parent.document).css("height", $(window.parent.window).height());
}
$(document).ready(resize);
$(window.parent.window).resize(resize);
</script>
或
框架主页面改变 rightFrame 框架高度JS代码如下:
<script>
function resize() {
$("#rightFrame").css("height", $(window).height());
}
$(document).ready(resize);
$(window).resize(resize);
</script>
注:
$(window).height() 获取浏览器可视高度
$(document).height() 获取页面高度
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。