iframe自适应高度

 

<script language="javascript">
var alinks = document.getElementsByTagName("a");
for(var i=0;i<alinks.length;i++){
   alinks[i].onclick = setWinHeightToogle;
}
function setWinHeightToogle(){
    window.setTimeout(setWinHeight,400);
}
function setWinHeight(){
	var win = window.parent.document.getElementById("eamoduleiframe");
	if(win != null){
		win.height = win.contentWindow.document.documentElement.scrollHeight+80;
	}
}
</script>

你可能感兴趣的:(JavaScript)