Mark Agius
September 21st, 2004, 12:20 PM
Read the position of a DIV/LAYER without first setting it's position.
Dear JavaScript / DHTML programmers,
I am creating a page with a image of a map.
I also have a small image (a flashing dot) in a DIV that moves over the map to show a root to a church.
All works well except that if I make the page narrower or wider then the number of text lines above this
image change.
This means that the top of the map moves up or down.
Which means that my flashing dot is too high or low.
I have put the map in some DIV tags.
Is there some way of reading the position of the DIV.
I don't want to set the position of the image/div, as I want it to move with the text.
(Otherwise there would be a big gap between the text and image or they will overlap)
Please see the example attached.
(File; PositionOfDIV_01.htm)
Once I have read the position of the DIV with my picture of a map in it. I can move the DIV with a flashing dot.
If I set the position of the DIV with map, then I can read it.
But if I don't set the position then I can't read the position/value.
P.S.
This should work with Microsoft Internet Explorer, Netscape Navigator and
any other browsers that suport Java Script.
Dear JavaScript / DHTML programmers,
I am creating a page with a image of a map.
I also have a small image (a flashing dot) in a DIV that moves over the map to show a root to a church.
All works well except that if I make the page narrower or wider then the number of text lines above this
image change.
This means that the top of the map moves up or down.
Which means that my flashing dot is too high or low.
I have put the map in some DIV tags.
Is there some way of reading the position of the DIV.
I don't want to set the position of the image/div, as I want it to move with the text.
(Otherwise there would be a big gap between the text and image or they will overlap)
Please see the example attached.
(File; PositionOfDIV_01.htm)
Once I have read the position of the DIV with my picture of a map in it. I can move the DIV with a flashing dot.
If I set the position of the DIV with map, then I can read it.
But if I don't set the position then I can't read the position/value.
P.S.
This should work with Microsoft Internet Explorer, Netscape Navigator and
any other browsers that suport Java Script.