473,408 Members | 2,477 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

offsetTop

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

Jul 23 '05 #1
6 7711
alu

"Francisco" <fr**************@gmail.com> 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
Jul 23 '05 #2
heave another way? because this page is a resultset interation and i
need to know it without knowing the another div offsetTop.

Jul 23 '05 #3
alu

"Francisco" <fr**************@gmail.com> 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
Jul 23 '05 #4
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>

Jul 23 '05 #5
alu

"Francisco" <fr**************@gmail.com> 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
Jul 23 '05 #6
ASM
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
Jul 23 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Gernot Frisch | last post by:
Hi, when I have this code in my script: pos_y = document.getElementById('holdmenu').offsetTop; The menu get's positioned at the very top of the site - really annoying. On FireFox it works good....
3
by: Markus Fischer | last post by:
Hi, I'm experiencing a wierd problem with IE 6 in Windows with two _slightly_ different Version. Give the following HTMl-Code, ideally the output of offsetTop should be "105"; a few pixel...
13
by: Matthew Hagston | last post by:
Trying to do some updating and beyond frustrations with making it compatibal with Mac's I am primarily done. Biggest problem I am having now is with Opera not displaying the menu. works fine in IE,...
4
by: Pf | last post by:
A piece of html code: <table> <tr> <td> <input type="text" name="myInput" onclick="myFunction(this)"> <td> </tr> </table>
1
by: Tarik Monem | last post by:
OK, you guys have helped me when I couldn't help myself, well I could but I couldn't if you know what I mean. So, here's another that I'm having issues with for just Safari -- tested in Firefox &...
2
by: rohitchawla | last post by:
have a problem with this code when working in IE it gives me 0,0 coords when i use iframe tag but gives correct coords when using firefox function GetRealOffset(id) { var elem =...
1
by: tromton | last post by:
Hello all, I have a problem with a scrript in safari 3. in mozilla/firefox and opera the problem does not exist. what i try to do: I have a div element with overflow:auto. in the element i have...
3
pragathik
by: pragathik | last post by:
hi, i have a problem with document.body.offsetTop and document.body.offsetLeft always returns null in my code in IE6. how can I get the values???? please suggest
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.