Javascript to get height of box dynamically
I have a table which displays some grid data for search results...Now the height of this table would vary each time.
So is there any way by which I could get the height of this dynamic table..
Basically I want to set an overflow:auto property for that table which would enable it to be scrolled on the iPad using 2-fin开发者_运维百科gers (I cannot do the scrolling using 1-finger as that table rows does the drag action for 1-finger)
Try :
var elem = document.getElementById("elementId");
var elemStyle = window.getComputedStyle(elem, null);
var height = elemStyle.getPropertyValue("height");
$('#tableid').height();
will get you the height (with jquery). I'm not sure how that's relevant to your desire to use overflow:auto.
You could try jQuery's height function.
You can get Dom element's hight using it's offsetHeight property.
精彩评论