ftl文件
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr>
<td width="100" valign="top" bgcolor="#eeeeee">
<table id="mytable" class="layui-table layui-form" lay-filter="l_table">
</table>
</td>
<td valign="top" height="800">
<iframe width=100% id="my-iframe" onload="setHeight()" height="1" frameborder="0" src=" " scrolling="no"></iframe>
</iframe>
</td>
</tr>
</table>
js文件
在js
中写入
function getIframeWindow(obj) {
return obj.contentWindow || obj.contentDocument.parentWindow;
}
function getIframeHeight(obj){
var idoc = getIframeWindow(obj).document;
if(idoc.body){
return Math.max(idoc.body.scrollHeight,idoc.body.offsetHeight);
}else if(idoc.documentElement){
return Math.max(idoc.documentElement.scrollHeight,idoc.documentElement.offsetHeight);
}
}
function setHeight(){
var myiframe = document.getElementById("myiframe");
myiframe.height = getIframeHeight(myiframe);
}