| 
			 
					阅读:8737回复:5
				 
				在firefox里的iframe自适应高度的问题!!!!!
					window.parent.document.getElementById("right_space").style.height=document.body.scrollHeight;
 
							以上javasript代码在ie里很正常,内嵌页面的body里执行这段代码时,能自动将父页面中的right_space的高度设置为内嵌页面的高度,但是在firefox里就不行,这是firefox的bug吗?我在w3c.org里检查我的页面了,是完全符合xhtml1.0标准的。  | 
	|
| 
			 1楼# 
								发布于:2005-10-28 17:21				
			
					你的代码我试过了,不论是在IE还是在FireFox中都能正常运行
 
							请检查你的iframe是否设了 id=right_space  | 
	|
| 
			 2楼# 
								发布于:2005-10-28 17:21				
			
					我这里可以自适应高度,使用同样的方法,却不能适应宽度!谁知道什么原因么?				 
							 | 
	|
| 
			 3楼# 
								发布于:2005-10-28 17:21				
			
					我也刚好碰到这个问题,这段代码没错
 
							但是在把页面中的DOCTYPE声明去掉就可以了  | 
	|
| 
			 4楼# 
								发布于:2005-10-28 17:21				
			
					<script type="text/javascript" language="javascript">
 
							<!-- //调整 PageContent 的高度 function TuneHeight() { var frm = document.getElementById("FM_Content"); var subWeb = document.frames ? document.frames["FM_Name"].document : frm.contentDocument; if(frm != null && subWeb != null) { frm.height = subWeb.body.scrollHeight;} } //--> </script> <iframe id="FM_Content" name="FM_Name" frameborder="0" height="530px" width="780px" src="Corporate/CorporateList.aspx" onLoad="TuneHeight()" scrolling="no"> </iframe>  | 
	|
| 
			 5楼# 
								发布于:2005-10-28 17:21				
			
					window.parent.document.getElementById("right_space").style.height=document.body.scrollHeight + 'px';				 
							 | 
	|