Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > offsetTop

Reply
Thread Tools

offsetTop

 
 
Francisco
Guest
Posts: n/a
 
      07-15-2005
Hi all,

I have a div (divI) inner another div (divM), when i request the
offsetTop of divI (inner) it returns me the top of divI in divM and not
the top of divI in the document? Have anyway to get this information?

Gratefull
Francisco

 
Reply With Quote
 
 
 
 
alu
Guest
Posts: n/a
 
      07-15-2005

"Francisco" <(E-Mail Removed)> wrote

> Hi all,
>
> I have a div (divI) inner another div (divM), when i request the
> offsetTop of divI (inner) it returns me the top of divI in divM and not
> the top of divI in the document? Have anyway to get this information?
>
> Gratefull
> Francisco
>


If you want to continue using offsetTop,

document.getElementById("divM").offsetTop+document .getElementById("divI").of
fsetTop


you'll still get different results in different browsers.
-alu


 
Reply With Quote
 
 
 
 
Francisco
Guest
Posts: n/a
 
      07-15-2005
heave another way? because this page is a resultset interation and i
need to know it without knowing the another div offsetTop.

 
Reply With Quote
 
alu
Guest
Posts: n/a
 
      07-15-2005

"Francisco" <(E-Mail Removed)> wrote
> heave another way? because this page is a resultset interation and i
> need to know it without knowing the another div offsetTop.



Post a real example, as it's impossible to tell how you've gone about
positioning them.
-alu


 
Reply With Quote
 
Francisco
Guest
Posts: n/a
 
      07-15-2005
an example...

<html>
<head>
</head>
<body>
<div id="divPrincipal" style="width:700px;border:1px #CFCFCF
solid;height:380;background-color:white;">
<div id="divCabecalho"
style="width:100%;height:85px;border-bottom:1px #CFCFCF
solid;">Header</div>
<div id="divConteudo"
style="width:100%;height:275px;padding:2px;">
<div id="MenuP">
<div class="menuPrincipal"
onmouseOver="MenuP0.style.top=this.offsetTop;
MenuP0.style.left=this.offsetLeft;MenuP0.style.dis play=''"
onmouseOut="MenuP0.style.display='none'">
<a href="#">File Menu</a>
</div>
</div>
<div id="MenuP0"
style="display:none; position:absolute;
background-color:#FBFBFB; border:1px #EBEBEB solid; padding:1px;"
onmouseover="this.style.display=''"
onmouseout="this.style.display='none'">
<div class="menuSecundario">
<a href="#">Option1</a>
</div>
</div>
</div>
</div>
</body>
</html>

 
Reply With Quote
 
alu
Guest
Posts: n/a
 
      07-15-2005

"Francisco" <(E-Mail Removed)> wrote
> an example...
>

<html>
<head>
</head>
<body>
<div id="divPrincipal" style="width:700px;border:1px #CFCFCF
solid;height:380;background-color:white;">
<div id="divCabecalho"
style="width:100%;height:85px;border-bottom:1px #CFCFCF
solid;">Header</div>
<div id="divConteudo"
style="width:100%;height:275px;padding:2px;">
<div id="MenuP">
<div class="menuPrincipal"
onmouseOver="MenuP0.style.top=this.offsetTop;
MenuP0.style.left=this.offsetLeft;MenuP0.style.dis play=''"
onmouseOut="MenuP0.style.display='none'">


-----------You have not defined MenuP0 ----
document.getElementById('MenuP0')-----


<a href="#">File Menu</a>
</div>
</div>
<div id="MenuP0"
style="display:none; position:absolute;
background-color:#FBFBFB; border:1px #EBEBEB solid; padding:1px;"
onmouseover="this.style.display=''"
onmouseout="this.style.display='none'">
<div class="menuSecundario">
<a href="#">Option1</a>
</div>
</div>
</div>
</div>
</body>
</html>
</html>


Without absolutely positioned divs, you would be forced to do a
quick google search, which would bring up
https://lists.latech.edu/pipermail/j...ry/006906.html

-alu


 
Reply With Quote
 
ASM
Guest
Posts: n/a
 
      07-18-2005
Francisco wrote:
> heave another way? because this page is a resultset interation and i
> need to know it without knowing the another div offsetTop.


http://www.quirksmode.org/js/findpos.html

--
Stephane Moriaux et son [moins] vieux Mac
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Wierd offsetTop value with relative positioned Element in table inWin IE 6 Markus Fischer Javascript 3 09-08-2004 01:35 PM
TD .offsetTop not working in IE6 Gernot Frisch Javascript 2 04-23-2004 06:57 AM



Advertisments