你iframe连接到远程的页面 跨域了无法获得页面高度的 

解决方案 »

  1.   

    自适应是在a.html加js就可以了
    具体(以前用过,没有测试):function SetWinHeight(obj)
    {
        var win=obj;
        if (document.getElementById)
        {
            if (win && !window.opera)
            {
                if (win.contentDocument && win.contentDocument.body.offsetHeight)                 win.height = win.contentDocument.body.offsetHeight; 
                else if(win.Document && win.Document.body.scrollHeight)
                    win.height = win.Document.body.scrollHeight;
            }
        }
    }//使用调用
    //<iframe width="778" align="center" height="200" id="win" name="win" onload="Javascript:SetWinHeight(this)" frameborder="0" scrolling="no"></iframe>解决跨域可以用本地文件直接获取远程文件的源码,模拟成本地的,如:http://www.fangleo.cn/get/phpGet.php?url=http://www.sohu.com
      

  2.   

    <iframe id="treeinfo" name="treeinfo" src="treeinfo.html" width="100%" height="100%" marginwidth="0" marginheight="0" frameborder="0" onload="this.style.height=treeinfo.document.body.scrollHeight+5" scrolling="no">
    </iframe>
    Try It
      

  3.   

    如果是JSP 可以这样写<%
    java.net.URL url = new java.net.URL("http://www.baidu.com/xxxx");
    java.net.HttpURLConnection connection = (java.net.HttpURLConnection) url.openConnection();
    connection.connect();
    urlStream = connection.getInputStream();
    java.io.BufferedReader reader = new java.io.BufferedReader(new java.io.InputStreamReader(urlStream));
    while ((line = reader.readLine()) != null)
    {%>
      <%=line%>
    <%}%>
    这样你框架里的页面就是baidu的页面了  再结合3楼的方法
      

  4.   

     onload="this.style.height=treeinfo.document.body.scrollHeight"即可,跨网站就得另外设置了.