如何从JavaScript内计算HTML表格的渲染高度? [英] How can I calculate the rendered height of an HTML table, from within JavaScript?
本文介绍了如何从JavaScript内计算HTML表格的渲染高度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当窗口调整大小时,我需要知道表格的大小,因此我可以动态地适应其他所有内容。表格高度完全取决于动态加载的内容。你如何计算在JavaScript中表的渲染高度?
When the window is resized, I need to know how big the table is, so I can dynamically fit everything else nicely in-between. The table height is solely dependant on the contents, which are loaded dynamically. How do you calculate the rendered height of the table in JavaScript?
推荐答案
您可以使用 element.offsetHeight
。
You can use element.offsetHeight
for this.
var table = document.getElementById("tableId");
alert(table.offsetHeight);
这篇关于如何从JavaScript内计算HTML表格的渲染高度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文