问题
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?
回答1:
You can use element.offsetHeight for this.
var table = document.getElementById("tableId");
alert(table.offsetHeight);
来源:https://stackoverflow.com/questions/2733666/how-can-i-calculate-the-rendered-height-of-an-html-table-from-within-javascript