You need to be able to identify the element--try giving the element an id, such as "myTextArea".
function getSize(id){
var el = document.getElementById(id);
var width = el.offsetWidth;
var height = el.offsetHeight;
alert( "Width: " + width +"px Height: " + height + "px");
}