如何让Iframe所在的页面自适应iframe的高度问题。 你iframe连接到远程的页面 跨域了无法获得页面高度的 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 自适应是在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 <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 如果是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楼的方法 onload="this.style.height=treeinfo.document.body.scrollHeight"即可,跨网站就得另外设置了. 日期控件jsp里好用。在js里写的不好用。跪求解决办法。大神们!!! 还是求一个正则表达式 江湖救急:如何用javascript实现类似sql中group by分组求和问题? 关于JS中的this 如何取input类型 加载xml 对象出错+++++++++++++++++++++++++++++++++++++十万火急 全部积分了 提交表单,判断是否为空的问题 关于iframe的问题,请教 请教如何用javascript调出IE的查找界面? 请问那位知道好的网页素材的网站 跪求:IE下JS正则无法消除中文前的空白 ajax返回的时候的问题
具体(以前用过,没有测试):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
</iframe>
Try It
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楼的方法