473,976 Members | 46,549 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 7752
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.getEle mentById("divM" ).offsetTop+doc ument.getElemen tById("divI").o f
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="divPrincipa l" style="width:70 0px;border:1px #CFCFCF
solid;height:38 0;background-color:white;">
<div id="divCabecalh o"
style="width:10 0%;height:85px; border-bottom:1px #CFCFCF
solid;">Header</div>
<div id="divConteudo "
style="width:10 0%;height:275px ;padding:2px;">
<div id="MenuP">
<div class="menuPrin cipal"
onmouseOver="Me nuP0.style.top= this.offsetTop;
MenuP0.style.le ft=this.offsetL eft;MenuP0.styl e.display=''"
onmouseOut="Men uP0.style.displ ay='none'">
<a href="#">File Menu</a>
</div>
</div>
<div id="MenuP0"
style="display: none; position:absolu te;
background-color:#FBFBFB; border:1px #EBEBEB solid; padding:1px;"
onmouseover="th is.style.displa y=''"
onmouseout="thi s.style.display ='none'">
<div class="menuSecu ndario">
<a href="#">Option 1</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="divPrincipa l" style="width:70 0px;border:1px #CFCFCF
solid;height:38 0;background-color:white;">
<div id="divCabecalh o"
style="width:10 0%;height:85px; border-bottom:1px #CFCFCF
solid;">Header</div>
<div id="divConteudo "
style="width:10 0%;height:275px ;padding:2px;">
<div id="MenuP">
<div class="menuPrin cipal"
onmouseOver="Me nuP0.style.top= this.offsetTop;
MenuP0.style.le ft=this.offsetL eft;MenuP0.styl e.display=''"
onmouseOut="Men uP0.style.displ ay='none'">
-----------You have not defined MenuP0 ----
document.getEle mentById('MenuP 0')-----
<a href="#">File Menu</a>
</div>
</div>
<div id="MenuP0"
style="display: none; position:absolu te;
background-color:#FBFBFB; border:1px #EBEBEB solid; padding:1px;"
onmouseover="th is.style.displa y=''"
onmouseout="thi s.style.display ='none'">
<div class="menuSecu ndario">
<a href="#">Option 1</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
4313
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. If I put this script part at the very end of the body, it works, too. Can you help me what's wrong here?
3
2880
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 plus minus would still be ok, whyever. I've tested this successfully on 6.0.2800.1106 on a german W2KPro machine, also with 6.0.2800.1106 on a german XPPro machine.
13
2077
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, NS, and Firefox. Due to the problem of having to have it target an iframe to update had to write my own menu. Do not get any errors, simply will not display at all. code of the menu and the css file is below. location of the html file is:...
4
5563
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
5053
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 & Opera & IE (mac -- yeah -- I still test IE5 on mac -- things are not perfectly aligned but the functionality works) -- why wouldn't it work in Safari (beta 3) Basically the function below is called when a onclick is clicked -- Now, it moves the...
2
11140
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 = document.getElementById(id); var leftOffset = elem.offsetLeft; var topOffset = elem.offsetTop; var parent = elem.offsetParent;
1
2113
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 several anchors, wich i can scroll to with several anchor links. this works quite nicely. the div content can be scrolled by a JS-scrolling script. when i click on a anchor link the scrolling script loses its position, so the next time i will...
3
4191
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
10355
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10911
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
10084
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7605
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6416
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6558
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
5156
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4731
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3762
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.