On 22 Mar, 17:08, "scripts.contact" <scripts.cont...@gmail.com> wrote:
> On Mar 22, 2:17 am, louv...@gmail.com wrote:
>
> > Hi,
> > I want to know the postion of the button.
>
> > My javascript code is :
>
> > boutonInserer = document.all.btn_inserer;
> > pos_left = document.all.TdBarreBouton2.offsetLeft +
> > boutonInserer.offsetLeft;
> > pos_top = document.all.TdBarreBouton2.offsetTop +
> > boutonInserer.offsetTop;
>
> use offsetParent
Be wary of offsetParent. It returns the parent element with respect to
positioning. So, if the current element is absolutely positioned, the
offsetParent may well be the document root node. If you want to be
sure of getting the parent node of the current element, irrespective
of any stylesheet positioning rules, then use parentNode instead.
wp.
|