V
Vittore Zen
Hi,
a little question.
I have some nested tables with some divs (so default set is relative - ok?)
Now, i need to draw a line from one div to another. The problem is to
find the position of div
I use these functions:
function findPosX(obj)
{
var curleft = 0;
if (obj.offsetParent)
{
while (obj.offsetParent)
{
curleft += obj.offsetLeft
obj = obj.offsetParent;
}
}
else if (obj.x)
curleft += obj.x;
return curleft;
}
function findPosY(obj)
{
var curtop = 0;
if (obj.offsetParent)
{
while (obj.offsetParent)
{
curtop += obj.offsetTop
obj = obj.offsetParent;
}
}
else if (obj.y)
curtop += obj.y;
return curtop;
}
But these give an error on offsetParent. The browser (IE 6) says that is
null (or it isn't a object).
Any idea?
Thanks
v.
a little question.
I have some nested tables with some divs (so default set is relative - ok?)
Now, i need to draw a line from one div to another. The problem is to
find the position of div
I use these functions:
function findPosX(obj)
{
var curleft = 0;
if (obj.offsetParent)
{
while (obj.offsetParent)
{
curleft += obj.offsetLeft
obj = obj.offsetParent;
}
}
else if (obj.x)
curleft += obj.x;
return curleft;
}
function findPosY(obj)
{
var curtop = 0;
if (obj.offsetParent)
{
while (obj.offsetParent)
{
curtop += obj.offsetTop
obj = obj.offsetParent;
}
}
else if (obj.y)
curtop += obj.y;
return curtop;
}
But these give an error on offsetParent. The browser (IE 6) says that is
null (or it isn't a object).
Any idea?
Thanks
v.