By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,570 Members | 970 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,570 IT Pros & Developers. It's quick & easy.

No offsetParent in Firefox?

P: n/a
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
Share this Question
Share on Google+
5 Replies


P: n/a
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

P: n/a


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

P: n/a
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

P: n/a
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

P: n/a

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 discussion thread is closed

Replies have been disabled for this discussion.