If I have a button defined as:
<input type="button" name="zzz">
I can determine the top position using the function getOffsetTop below
like:
var tableTop = getOffsetTop(zz zz); //and I get a valid
value
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.
onclick=temp(zz zz);
function temp(mybutton)
{
var tableTop = getOffsetTop(my button);
}
function getOffsetTop (el)
{
var ot = el.offsetTop;
while ( ( el = el.offsetParent ) != null )
{
ot += el.offsetTop;
}
return ot;
}
<input type="button" name="zzz">
I can determine the top position using the function getOffsetTop below
like:
var tableTop = getOffsetTop(zz zz); //and I get a valid
value
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.
onclick=temp(zz zz);
function temp(mybutton)
{
var tableTop = getOffsetTop(my button);
}
function getOffsetTop (el)
{
var ot = el.offsetTop;
while ( ( el = el.offsetParent ) != null )
{
ot += el.offsetTop;
}
return ot;
}
Comment