By mmurph211
via matts411.com
Submitted: Mar 27 2008 / 13:16
The following are two similiar functions you may find useful. When called on an element, they can return (in pixels) either:
* The width/height
* The width/height including padding
* The width/height including borders
* The width/height including padding and borders (basically offsetWidth/offsetHeight)
The functions work on any (block?) element, regardless of whether or not it has a predefined width/height. They've been tested in Internet Explorer 6 & 7, Firefox, Safari and Opera.
SaveShareSend
Tags: css-html, javascript, usability, web design
Add your comment