让iframe自动适应内容高度 main.htm中的iframe的设置: <iframe src="d.htm" id="XX" style=" 100%"></iframe> 在firame中调用的d.htm里设置: <body onload="parent.window.document.getElementById('XX').height=document.body.scrollHeight;">