Javascript Reference
Categories: DIV

javascript DIV clientHeight, clientWidth

@July 7, 2008, 4:28 a.m.
clientHeight, clientWidth Firefox/Netscape/NN 7 IE 4 Chrome/Safari/DOM n/a  



Broadly speaking, these provide the height and width of the DIV element's content, but with minor variations with respect to element padding among various operating system versions of IE and compatibility modes controlled by the DOCTYPE declaration. Not available for all element types in IE for Macintosh. For Netscape 7, values are zero except when an element's content overflows the viewable area, in which case the values reveal the dimensions of the viewable area (e.g., the browser window's content region for the document.body element).

var midHeight = document.body.clientHeight/2;

Integer pixel value.



Powered by Linode.