iframe自适应高度

function iFrameHeight() { 
	var ifm= document.getElementById("common"); //获得iframe,common为iframe的ID 
	//document.frames['common'].document是IE6 IE7中的方法 
	var subWeb = document.frames ? document.frames["common"].document : ifm.contentDocument; 
	if(ifm != null && subWeb != null) { 
		$(ifm).height(subWeb.body.scrollHeight);
	} 
} 

posted on 2014-03-07 21:03  itmyhome  阅读(142)  评论(0编辑  收藏  举报

导航