Javascript - Getting CSS width and height values

function getCSS(element, property) { var elem = document.getElementById(element); var css = null; if(elem.currentStyle) { css = elem.currentStyle[property]; } else if(window.getComputedStyle) { css = document.defaultView.getComputedStyle(elem, null).getPropertyValue(property); }return css;}
var width = getCSS(test, width);var height = getCSS(test, height);alert(parseInt(width)); // 100alert(parseInt(height)); // 100