It really depends on the browser ... I have some code that I use to create a text area with auto-extension adapted from the found there code .
, $ Prototype.
function getStyleFromCss(el, style) {
var value = $(el).getStyle(style);
if (!value) {
if(document.defaultView) {
value = document.defaultView.getComputedStyle(el, null).
getPropertyValue(style);
} else if(el.currentStyle) {
value = el.currentStyle[style];
}
}
if(value.length > 0){
if (value.charAt(value.length-1) == "x") {
value = parseInt(value.substring(0, value.length-2));
}
}
return value;
}
getStyle() Prototype , .
getStyle: function(element, style) {
element = $(element);
style = style == 'float' ? 'cssFloat' : style.camelize();
var value = element.style[style];
if (!value || value == 'auto') {
var css = document.defaultView.getComputedStyle(element, null);
value = css ? css[style] : null;
}
if (style == 'opacity') return value ? parseFloat(value) : 1.0;
return value == 'auto' ? null : value;
},