2013-01-22 42 views
0

我有一个div,并在该div下面显示一个div与加载在同一页的html页面的iframe dynamicaly ..但会发生什么是div与iframe覆盖上部分作为iframe包含html haev长高度..任何人都可以请告诉我,我可以把包含iframe的div放在div标签下面,而不管iframe中加载了哪些内容。另外我想让它看起来和chrome以及mozila一样。如何将Div位置始终固定在其他上方div下方?

以下是我的结构...

<div class="row-fluid"> 
    <div class="span3" id="media_select"> 
      <label 
       style="float: left; padding-top: 5px; padding-bottom: 10px; padding-right: 10px; padding-left: 22px"> Media 
      </label><select style="width:125px" name="mediatype" id="mediatype" 
       data-placeholder="- Select Ad Type -" class="chzn-select" 
       tabindex="4"> 
       <option value="0">Select All</option> 
       <% 
        List<mediatype> media_typelist = mediatypeLocalServiceUtil 
          .getAllMediaType(); 
        for (mediatype media_typelistitem : media_typelist) { 
       %> 
       <option value=<%=media_typelistitem.getPrimaryKey()%>><%=media_typelistitem.getMedianame()%></option> 
       <% 
        } 
       %> 
      </select> 

     </div> 
     <div class="span3"> 


     </div> 

//这就是我想固定就在上师下面的DIV

<div class="bordercolor" id="mydiv" style="display: none; text-align: center"> 

    <IFRAME SRC="" id="reportpreview" style="text-align: center;" 
     marginheight="0" frameborder="0" onLoad="sizeFrame();"></iframe> 

</div> 

高度iframe的下面的脚本中dynmaiclly分配: -

function sizeFrame() { 
    var F = document.getElementById('reportpreview'); 
    if(F.contentDocument) { 
    F.height = F.contentDocument.documentElement.scrollHeight+30; //FF 3.0.11, Opera 9.63, and Chrome 
    } else { 



    F.height = F.contentWindow.document.body.scrollHeight+30; //IE6, IE7 and Chrome 

    } 

    } 

/// CSS的报告预览ID //将iframe

#reportpreview { 
     float:center; 
     margin-top:10%; 
     margin-bottom:10%; 
     zoom: 1.2; 
     -moz-transform: scale(1.2); 
     -moz-transform-origin: 2 0; 
     -webkit-transform: scale(1.2); 
     -webkit-transform-origin: 2 0; 
     width: 720px; 
     min-height: 37px; 



    } 

回答

1
#reportpreview { 
    clear:left; 
    float:center; 
    margin-top:10%; 
    margin-bottom:10%; 
    zoom: 1.2; 
    -moz-transform: scale(1.2); 
    -moz-transform-origin: 2 0; 
    -webkit-transform: scale(1.2); 
    -webkit-transform-origin: 2 0; 
    width: 720px; 
    min-height: 37px; 
    } 

添加clear:left到iframe中的div

+0

它只是每次移动我加载相同的iframe.first时间其显示好//但当我加载相同的东西,然后它移动到上边。这只发生在铬 –

+0

然后你必须添加明确的财产更高的股利也就是'清除:正确'它的上部分 – Milind

+0

我做了..但它不工作 –