473,508 Members | 3,343 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

No offsetParent in Firefox?

In XHTML mode (application/xhtml+xml) Firefox does not know offset
properties (offsetParent/Left/Top). In all the other browsers it works.
Does someone has the same problem or knows a solution for this?
Example:

....
<body>

<div><div id="hello">Hey</div></div>

<div id="debug"></div>

<script type="text/javascript">
//<![CDATA[
alert(document.getElementById('hello').offsetParen t);
//]]>
</script>

</body>
....

In Firefox offsetLeft and offsetTop is 0, the script above shows null
as result. Can somebody help me?

Andi

Dec 19 '06 #1
5 8086
webEater wrote:
In XHTML mode (application/xhtml+xml) Firefox does not know offset
properties (offsetParent/Left/Top). In all the other browsers it works.
Does someone has the same problem or knows a solution for this?
Example:

...
<body>

<div><div id="hello">Hey</div></div>

<div id="debug"></div>

<script type="text/javascript">
//<![CDATA[
alert(document.getElementById('hello').offsetParen t);
//]]>
</script>

</body>
...

In Firefox offsetLeft and offsetTop is 0, the script above shows null
as result. Can somebody help me?

Andi
XHTML MIME types are not ready for prime time in a lot of respects :-P
For example, there is no such thing as incremental loading of an XHTML
document served with the proper MIME type.

If you're keen on using application/xhtml+xml anyway, you might ask in
mozilla.dev.tech.javascript on news.mozilla.org - they will be far
better equipped to handle mozilla-specific javascript questions.

Also try mozilla.dev.tech.dom.

Jeremy
Dec 19 '06 #2


On 19 Dez., 02:36, Jeremy <jer...@pinacol.comwrote:
webEater wrote:
In XHTML mode (application/xhtml+xml) Firefox does not know offset
properties (offsetParent/Left/Top). In all the other browsers it works.
Does someone has the same problem or knows a solution for this?
Example:
...
<body>
<div><div id="hello">Hey</div></div>
<div id="debug"></div>
<script type="text/javascript">
//<![CDATA[
alert(document.getElementById('hello').offsetParen t);
//]]>
</script>
</body>
...
In Firefox offsetLeft and offsetTop is 0, the script above shows null
as result. Can somebody help me?
AndiXHTML MIME types are not ready for prime time in a lot of respects :-P
For example, there is no such thing as incremental loading of an XHTML
document served with the proper MIME type.

If you're keen on using application/xhtml+xml anyway, you might ask in
mozilla.dev.tech.javascript on news.mozilla.org - they will be far
better equipped to handle mozilla-specific javascript questions.

Also try mozilla.dev.tech.dom.

Jeremy
Thank you, I have posted on mozilla.dev.tech.dom. Although - is there
an other way to find out the real position of an element to a parent
one?

Andi

Dec 19 '06 #3
webEater wrote:
In XHTML mode (application/xhtml+xml) Firefox does not know offset
properties (offsetParent/Left/Top). In all the other browsers it works.
Does someone has the same problem or knows a solution for this?
Example:

...
<body>

<div><div id="hello">Hey</div></div>

<div id="debug"></div>

<script type="text/javascript">
//<![CDATA[
alert(document.getElementById('hello').offsetParen t);
//]]>
</script>
I am sure it is available if you wait for the page to be loaded. Mozilla
so far for XML parsing and rendering has no incremental approach that
would allow script called _during page load_ to get such values correctly.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Dec 19 '06 #4
webEater wrote:
In XHTML mode (application/xhtml+xml) Firefox does not know offset
properties (offsetParent/Left/Top). In all the other browsers it works.
Does someone has the same problem or knows a solution for this?
Example:

...
<body>

<div><div id="hello">Hey</div></div>

<div id="debug"></div>

<script type="text/javascript">
//<![CDATA[
alert(document.getElementById('hello').offsetParen t);
//]]>
</script>

</body>
<script type="text/javascript">
//<![CDATA[
onload=function(){ alert(document.getElementById('hello').offsetParen t);}
//]]>
</script>

How does that work for you?
Mick
...

In Firefox offsetLeft and offsetTop is 0, the script above shows null
as result. Can somebody help me?

Andi
Dec 19 '06 #5

mick white schrieb:
webEater wrote:
In XHTML mode (application/xhtml+xml) Firefox does not know offset
properties (offsetParent/Left/Top). In all the other browsers it works.
Does someone has the same problem or knows a solution for this?
Example:

...
<body>

<div><div id="hello">Hey</div></div>

<div id="debug"></div>

<script type="text/javascript">
//<![CDATA[
alert(document.getElementById('hello').offsetParen t);
//]]>
</script>

</body>

<script type="text/javascript">
//<![CDATA[
onload=function(){ alert(document.getElementById('hello').offsetParen t);}
//]]>
</script>

How does that work for you?
Mick
...

In Firefox offsetLeft and offsetTop is 0, the script above shows null
as result. Can somebody help me?

Andi
I haven't tried it out but i am sure itr works. In the mozilla dev
group they said that the Gecko engine does not builds up the dom (or
whatevery) completely until the complete page ha been loaded. After
complete loading offsetParent etc are computed, so I have to take
onload or domload..

Dec 21 '06 #6

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

Similar topics

1
8108
by: Vittore Zen | last post by:
Hi, a little question. I have some nested tables with some divs (so default set is relative - ok?) Now, i need to draw a line from one div to another. The problem is to find the position of...
3
7604
by: ara.pehlivanian | last post by:
I've got a script that determines the true position of an element in the page by cycling up the .offsetParent elements all the way up to the <body> element and tallying up the .offsetLeft values...
1
2029
by: Ned Baldessin | last post by:
Hi, I have reimplemented the non-standard <marquee> element (in a very simplified fashion), moving around a DIV using offsetParent and offsetWidth. It works fine in Mozilla (1.7.5) and Safari...
2
15796
by: amattie | last post by:
Anyone know what the specific difference is between the offsetParent and parentNode properties of a DOM element are? Mozilla's docs on the DOM element...
1
3623
by: Orion | last post by:
In my code i am trying to access offsetLeft and offsetTop values for a element which is a div, I use offsetParent property to obtain the same. The code i use is this.tip.style.left =...
2
2385
by: T0mm0 | last post by:
I'm trying to set the offsetParent property of an object to a reference to document rather than the relatively positioned container that it's in. The reason for this is that the object is a...
2
2235
by: Geoffrey Summerhayes | last post by:
I'm trying to select a row from a table in a 'dialog box' where the HTML is (boiled down): <body> <div style='position:absolute; display:block;...'> ...other divs... <div...
1
1768
by: Fabian Lenzen | last post by:
Hi, I’m creating a web application using XUL and SVG. My problem: I’ve tried to draw for example a dot where the user clicks in the SVG area. I get the clientX/Y-data of the event, but I also...
3
2952
by: Patient Guy | last post by:
Can anyone point to THE definition or THE standard for the useful DOM node property 'offsetParent'? It clearly seems de facto, and not de jure ("official"). This is acceptable, especially if...
0
7229
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,...
0
7333
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
7398
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...
1
7061
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7502
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
5637
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,...
1
5057
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...
0
1566
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 ...
0
428
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...

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.