PHP and javascript snippets you can copy and paste.

Thursday, June 7, 2007

js_get_elementWidth

/**
* Get the width of an element
*
* Credit: http://www.aspandjavascript.co.uk/javascript/javascript_api/get_element_width_height.asp
*/
function js_get_elementWidth(elem) {

if (elem.style.pixelWidth) {
xPos = elem.style.pixelWidth;
}
else {
xPos = elem.offsetWidth;
}

return xPos;

}

No comments: