jsp中iframe填充装个页面

首先要引入这个css,由于我之前没有引入这个,导致iframe的高度一只是默认高度,没有改变

<style type="text/css">
body, html {
    width: 100%;
    height: 100%;
}
</style>

iframe的设置例子:

<iframe id="treeIframe" frameborder="0" width="20%" scrolling="yes"
            height="95%" src="listHbase.do" style="float: left;"></iframe>

整个的jsp例子,

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link href="css/web_common.css" rel="stylesheet" type="text/css" />

<style type="text/css">
body, html {
    width: 100%;
    height: 100%;
}
</style>
</head>
<body  >
 
    
        <iframe id="treeIframe" frameborder="0" width="20%" scrolling="yes"
            height="95%" src="listHbase.do" style="float: left;"></iframe>
    
    
        <iframe id="tableIframe" frameborder="0" width="80%" scrolling="yes"
            height="95%" src="table.do" style="float: right;"></iframe>

     
    <!-- 用于调试页面对iframe的大小
<div class="content" id="content">
        <iframe id="frame3d" name="frame3d" 
            frameborder="0" width="100%" scrolling="yes" height="100%"
            src="table.do"></iframe>

    </div>
      -->
</body>
</html>

效果的样子:

如果上面的还不行,就加上这个

<script type="text/javascript">
    function setContentHeight() {
        document.getElementById("content").style.height = document.body.clientHeight
                - 150 + "px";
    }
</script >

记得在<body>上调用

<body onLoad="setContentHeight();" >

 

转载于:https://www.cnblogs.com/zhuzhixijiang/p/5112245.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值