P
Petra Meier
Hi,
I use the common code to determine the position of an element
getTop = function(o){
var nTop = null;
if(o){
do{
nTop += o.offsetTop;
o = o.offsetParent;
} while(o)
}
return nTop;
}
getLeft = function(o){
var nLeft = null;
if(o){
do{
nLeft += o.offsetLeft;
o = o.offsetParent;
} while(o)
}
return nLeft;
}
works fine as long I use Internet Explorer (version 6)
and want to get positions of elements that are in _relative_ DIVs that
have a _margin_ attached to it
i.e.
#mainDiv { position:relative ; top:115px ; margin-left:150px ;
margin-right:0px ;}
then the margins width (here left-margin) is also counted and my
position shifted to left by 150 pixels
any idea?
pm
I use the common code to determine the position of an element
getTop = function(o){
var nTop = null;
if(o){
do{
nTop += o.offsetTop;
o = o.offsetParent;
} while(o)
}
return nTop;
}
getLeft = function(o){
var nLeft = null;
if(o){
do{
nLeft += o.offsetLeft;
o = o.offsetParent;
} while(o)
}
return nLeft;
}
works fine as long I use Internet Explorer (version 6)
and want to get positions of elements that are in _relative_ DIVs that
have a _margin_ attached to it
i.e.
#mainDiv { position:relative ; top:115px ; margin-left:150px ;
margin-right:0px ;}
then the margins width (here left-margin) is also counted and my
position shifted to left by 150 pixels
any idea?
pm