日期:2014-05-18  浏览次数:20535 次

GridView模板别 中使用iframe高度自适问题,顶者有分(第2次发贴)
<asp:GridView   ID= "GVItemList "   runat= "server "   AutoGenerateColumns= "False "   EnableTheming= "True "   GridLines= "None ">
        <Columns>
              <asp:TemplateField>
                  <ItemTemplate>
                      <table   border= "0 "   cellpadding= "0 "   cellspacing= "0 "   style= "width:700px ">
                              <tr>
                                    <td> <span   style= "color:#003399;   font-size:3 "> <iframe   src= "http://192.168.1.6:81/html/PM/ <%#   Eval( "roomid ")%> .htm "   width= "700px "   frameborder= "0 "   id= "frmsrc "   marginheight= "0 "> </iframe> </span> </td>
                                </tr>
                        </table>
                    </ItemTemplate>
                <ItemStyle   CssClass= "ContextMenuColumn "   />
                </asp:TemplateField>
        </Columns>
</asp:GridView>

如上我在GridView中使用模板列中的iframe   连接不同htm页面(没有跨域),但高度不能动态改变,每个htm页面的高度不同的,我用过类似
parent.document.all( "框架ID名 ").style.height=document.body.scrollHeight;  
很多javascript   都不管用。   请各位高手帮帮忙,如何让高度自适。


------解决方案--------------------
up
------解决方案--------------------
http://community.csdn.net/Expert/topic/5734/5734046.xml?temp=.9440271
------解决方案--------------------
up 学习
------解决方案--------------------
document.body.scrollHeight是当前窗口的文档高度:
parent.document.all( "框架ID名 ").style.height=document.body.scrollHeight;
=> >
document.all( "框架ID名 ").height=document.all( "框架ID名 ").contentWindow.document.body.scrollHeight;
------解决方案--------------------
顶先!!
------解决方案--------------------
不知道,js文盲
------解决方案--------------------
这个我也碰见过....当时解决方法就是让这个iframe高度很大 这样就行了= =
------解决方案--------------------
为什么要用iframe?
------解决方案--------------------
up
------解决方案--------------------
没有看明白,帮LZ顶个先
------解决方案--------------------
写一段js啊!!
function iframeAutoFit()
{
try