offset top calculation problem

Giganews Newsgroups
Subject: offset top calculation problem
Posted by:  Michael Hill (hill…
Date: Tue, 02 Sep 2003

If I have a button defined as:
<input type="button" name="zzz">

I can determine the top position using the function getOffsetTop below
var tableTop = getOffsetTop(zzzz);                //and I get a valid

However if I have another function involved where the button name is
being passed to it I'm having a problem not knowing how to call this.


function temp(mybutton)
    var tableTop = getOffsetTop(mybutton);

function getOffsetTop (el)
        var ot = el.offsetTop;
        while ( ( el = el.offsetParent ) != null )
            ot += el.offsetTop;
          return ot;