日期:2014-05-17  浏览次数:20550 次

如何让div自动适应长度
我想做一个页面如下图所示 根据DIV2 DIV3 DIV4中内容的多少会自动拉伸 且DIV2 DIV3 DIV4的长度一致 请问该怎么写?

[img=http://social.msdn.microsoft.com/Forums/getfile/153273][/img]

------解决方案--------------------
我这个是做自适应高度的框架,看看有启发么,应该改一点就能用的了

<td valign="top">
                    <iframe src="../简介.aspx" id="iframe" name="iframe" frameborder="0" scrolling="no"
                        width="100%" onload="iFrameHeight()"></iframe>
                    <script type="text/javascript" language="javascript">
                        function iFrameHeight() {
                            var ifm = document.getElementById("iframe");
                            var subWeb = document.frames ? document.frames["iframe"].document : ifm.contentDocument;
                            if (ifm != null && subWeb != null) {
                                ifm.height = subWeb.body.scrollHeight + 18;
                            }
                        } 
                    </script>
                </td>