473,238 Members | 1,968 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,238 software developers and data experts.

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 8066
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
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
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
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
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
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
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
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
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
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...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, youll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

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.