被这个问题折磨了好久,试了很多方法都不行,总算解决了,记录一下。
<div class="iframe-pro" id="iframe-proid">
<iframe marginwidth="0" marginheight="0" hspace=0 vspace=0 frameborder="0" name="detail" frameBorder=0 scrolling=no
src="${base}/detail/${tempId}" onLoad="iFrameHeight()" width="920" id="detail" ></iframe>
</div>
<script type="text/javascript" language="javascript">
function iFrameHeight() {
var ifm = document.getElementById("detail");
var subWeb = document.frames ? document.frames["detail"].document : ifm.contentDocument;
if (ifm != null && subWeb != null) {
ifm.height = subWeb.body.scrollHeight;
$('#iframe-proid').css({height:ifm.height});
}
}
</script>