Connecting Tech Pros Worldwide Forums | Help | Site Map

right position of Div tag

John Giblin
Guest
 
Posts: n/a
#1: Jul 20 '05
I am using the createElement to create a div tag, which contains. I
also use a div as a placeholder so I know where to move the new
created tag. The problem that I am having is to getting the position
of the right side of the div tag.

Does anyone know how to get the position of the right side of an
element.

John

Paul Wellner Bou
Guest
 
Posts: n/a
#2: Jul 20 '05

re: right position of Div tag


Hi John,

I read some day something about a very strange method to
get the position of elements of a HTML Document even if the
elements aren't postioned absolutely, but I don't remember
and I never used it. Anyway, it only worked in IE, if I remember
it well.

Answering your question...
Does the div, you mentioned, has an absolute position?
You place it with

[HTMLDivElement].style.left = "10px";

(or any other value) at the place you want it to appear?

If you want to do it relative to the right margin, why don't you
use ...style.right instead?

If you can't use that, it will be difficult to get the right value,
if the width of this element isn't fixed.
But you can fix the width of the div by css (or JavaScript setting
the CSS Property). Then the right value is width+left.

In Addition you can use overflow: hidden or overflow: auto to
avoid that the width of the div changes if there is some content
like images that forces the div to increase its width automatically.

Hope I helped you.

Saludo
Paul.
W d'Anjos
Guest
 
Posts: n/a
#3: Jul 20 '05

re: right position of Div tag


Take a look at:

"Measuring Element Dimension and Location"
http://msdn.microsoft.com/library/de.../measuring.asp

I hope this helps.

Wagner

jwgiblin3@hotmail.com (John Giblin) wrote in message news:<3d6785ec.0310070650.d47e073@posting.google.c om>...[color=blue]
> I am using the createElement to create a div tag, which contains. I
> also use a div as a placeholder so I know where to move the new
> created tag. The problem that I am having is to getting the position
> of the right side of the div tag.
>
> Does anyone know how to get the position of the right side of an
> element.
>
> John[/color]
John Giblin
Guest
 
Posts: n/a
#4: Jul 20 '05

re: right position of Div tag


Paul, thanks for your answer. I really didnt give you the full
picture. The thing that I am trying to do is overlay events in a
calendar. Since some events are one day and other are more, I would
need both the left and right positions. So, now a div element can be
overlayed either 1 or many td's.I am not sure if this is posible since
I have other concerns of resizing the page.


thanks for your help


Paul Wellner Bou <paul.wellner@united-scripts.com> wrote in message news:<oprwokxzptq6cjlk@news.individual.net>...[color=blue]
> Hi John,
>
> I read some day something about a very strange method to
> get the position of elements of a HTML Document even if the
> elements aren't postioned absolutely, but I don't remember
> and I never used it. Anyway, it only worked in IE, if I remember
> it well.
>
> Answering your question...
> Does the div, you mentioned, has an absolute position?
> You place it with
>
> [HTMLDivElement].style.left = "10px";
>
> (or any other value) at the place you want it to appear?
>
> If you want to do it relative to the right margin, why don't you
> use ...style.right instead?
>
> If you can't use that, it will be difficult to get the right value,
> if the width of this element isn't fixed.
> But you can fix the width of the div by css (or JavaScript setting
> the CSS Property). Then the right value is width+left.
>
> In Addition you can use overflow: hidden or overflow: auto to
> avoid that the width of the div changes if there is some content
> like images that forces the div to increase its width automatically.
>
> Hope I helped you.
>
> Saludo
> Paul.[/color]
Closed Thread