首页 新闻 会员 周边

页面上两个table嵌套后,又嵌套一个iframe 怎么自适应iframe的高度

0
悬赏园豆:30 [已解决问题] 解决于 2013-03-13 11:31

代码如下:

 

View Code
 1 <body scroll="no" onresize="compute();">
 2     <form id="form1" runat="server">
 3         <div>
 4             <table cellpadding="0" cellspacing="0" id="MainTable">
 5                 <tr style="height: 162px">
 6                     <td>
 7                         <table cellpadding="0" cellspacing="0" style="width: 100%; height: 100%">
 8                             <tr>
 9                                 <td style="background-image: url(images/tdbj.gif); background-repeat: repeat;
10                                     background-position-x: right;" id="lefttop">
11                                     &nbsp;
12                                 </td>
13                                 <td id="banner" style="width: 990px; height:162px; background-image: url(../../images/mhr/banner.png); background-repeat: no-repeat">
14                                 </td>
15                                 <td style="background-image: url(images/tdbj.gif); background-repeat: repeat;
16                                     background-position-x: left;" id="righttop">
17                                 </td>
18                             </tr>
19                         </table>
20                     </td>
21                 </tr>              
22                 <tr>
23                     <td>
24                         <table cellpadding="0" cellspacing="0" style="width: 100%; height: 100%">
25                             <tr>
26                                 <td style="background-image: url(images/tdbj.gif); background-repeat: repeat;
27                                     background-position-x: right;border-right: #ffdaaf 1px solid;" id="ledttd">
28                                      &nbsp;
29                                 </td>
30                                 
31                                 <td id="MianTD" style="text-align: center">
32                                     <div style="width: 100%; height: 100%; overflow:hidden; text-align :center" id="mainDIV">
33                                     <iframe id ="reportIframe" style ="width :80%; height :100%" frameborder ="0"></iframe>
34                                        </div>
35                                 </td>
36                                 <td style="background-image: url(images/tdbj.gif); background-repeat: repeat;
37                                     background-position-x: left; border-left: #ffdaaf 1px solid;" id="righttd">
38                                     &nbsp;
39                                 </td>
40                             </tr>
41                         </table>
42                     </td>
43                 </tr>
44                 <tr style="height: 49px">
45                     <td>
46                         <table cellpadding="0" cellspacing="0" style="width: 100%; height: 49px; background-image: url(images/alert18.gif);
47                             background-repeat: repeat-x;">
48                             <tr>
49                              <td  style="border-right-color: #ffdaaf; border-right-width: 1px; border-right-style: solid;background-image: url(images/tdbj.gif); background-repeat: repeat;
50                                     background-position-x: right;" id="leftbottom">
51                                     &nbsp;
52                                 </td>
53                                 <td id="bottomcenter" style="border-right-color: #ffdaaf; border-right-width: 1px; border-right-style: solid;background-image: url(../../images/bottom.jpg); background-repeat: no-repeat;
54                                     background-position-x: center">&nbsp;
55                                 </td>
56                                   <td style="background-image: url(images/tdbj.gif); background-repeat: repeat;
57                                     background-position-x: right;" id="rightbottom">
58                                 </td>
59                             </tr>
60                         </table>
61                     </td>
62                 </tr>
63             </table>
64         </div>
65     </form>
66 </body>

 

其中ID为reportIframe的iframe的内容比较多,但是body的高度缺不会因此而变高,导致iframe处的td出现滚动条,请问怎么解决,我想让最外层出现滚动条,table适应iframe的高度。谢谢。

晨之风的主页 晨之风 | 菜鸟二级 | 园豆:373
提问于:2013-03-12 13:43
< >
分享
最佳答案
0

我觉得级别低的不可以决定比它高的元素吧,如果你不想出现滚动条的话你可以让内容的overflow属性显示为hidden,而添加>>more这样的方式。研究web前端没多久希望帮到你。

收获园豆:30
zy121 | 初学一级 |园豆:107 | 2013-03-12 19:11

已经解决了,iframe的高度能决定他的父窗体中td的高度。就你自己回答,豆豆给你了。

晨之风 | 园豆:373 (菜鸟二级) | 2013-03-13 11:31
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册