Hi this has been bugging me most of the day, should be nice and simple but I must be doing something simple wrong. Or maybe it's IE.
I've created a function that returns the xy coordinates of an element. Then a div is positioned using these xy values. I've got it working for most browsers. But this ones not so easy.
Would someone be able to help out: either post up a function that they've used to position in IE for Mac or suggest what I might be doing wrong.
Here's the function that I'm using to get the x value, the y value is very similiar so I'm not going to post this:
as i said this aint quite working as hoped on IE for MAC. Any help greatly appreciated.
Cheers,
foz
I've created a function that returns the xy coordinates of an element. Then a div is positioned using these xy values. I've got it working for most browsers. But this ones not so easy.
Would someone be able to help out: either post up a function that they've used to position in IE for Mac or suggest what I might be doing wrong.
Here's the function that I'm using to get the x value, the y value is very similiar so I'm not going to post this:
Code:
function getY(element)
{
var el;
var x;
if(document.getElementById)
el = document.getElementById(element);
else if(document.all)
el = document.all[element];
x = el.offsetLeft;
tempEl = el.offsetParent;
while(tempEl != null)
{
x += tempEl.offsetLeft;
tempEl = tempEl.offsetParent;
}
return x;
}
Cheers,
foz