iframe自适应高度
<script type="text/javascript">
function fit(){
var frameWin = document.getElementById("MainForm");
var frameBox = document.getElementById("ifmain");
var newHeight;
if (frameWin.Document){
newHeight = frameBox.Document.body.scrollHeight + 20 + "px";
}else{
newHeight = frameBox.contentDocument.body.scrollHeight + 20 + "px";
}
frameBox.style.height = newHeight;
}
</script>
<body onload="fit();" onResize="fit();">
<form id="MainForm" runat="server">
<iframe id="ifmain" frameborder="0" width="100%" height="100%" marginwidth="0" onload="fit();" src="test.html"></iframe>
</form>
</body>
浙公网安备 33010602011771号