Inhaltsverzeichnis

Eigenschaften eines Elements

function getProperty (o){
    var r = { top:0, left:0, width:0, height:0 };
    if(!o) return r;
    else if(typeof o == 'string' ) o = document.getElementById(o);
    if( typeof o != 'object' ) return r;
    if(typeof o.offsetTop != 'undefined')    {
         r.height = o.offsetHeight;
         r.width = o.offsetWidth;
         r.left = r.top = 0;
         while (o && o.tagName != 'BODY')         {
              r.top  += parseInt( o.offsetTop );
              r.left += parseInt( o.offsetLeft );
              o = o.offsetParent;
         }
    }
    return r;
}