I think I might be going insane here.
readLeft is working fine.
readTop isn't working fine - it is apparently giving the wrong numbers for some fields, but I can't figure it out why - both functions look the same?
JavaScript code:
function readTop(element,amount)
{
if (element.parentNode)
{
amount = amount + readTop(element.parentNode, amount);
}
if (element.offsetTop)
{
return amount + element.offsetTop;
}
else
{
return amount;
}
}
function readLeft(element,amount)
{
if (element.parentNode)
{
amount = amount + readLeft(element.parentNode, amount);
}
if (element.offsetLeft)
{
return amount + element.offsetLeft;
}
else
{
return amount;
}
}
Oh shit. I've just tested it in Firefox, and its not working there at all.
Ok, Firefox just needed the 'px' manually added on when assigning the top/left of the moving element.
It's still buggering about producing the wrong tops though.
Why why why why why?
:'(EDITED: 30 Nov 2006 16:56 by BOUGHTONP