Wierd offsetTop value with relative positioned Element in table inWin IE 6

M

Markus Fischer

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.

When I tested it on 6.0.2600.0000 the output is "209". What?! The
HTML-snipplet below is ripped of from a pretty complex page layout; it's
the bare minimum which reproduces the problem quite well.

My only goal was to find out the exact position of the DIV scroller once
the page is rendered so I can apply some method to emulate a scrolling
mechanism. But this wierd result prevents me from does this. It's
completely useless, I've searched google quite a while but couldn't find
anything.

I hope someone can test this on an english version of XP, maybe with
same version or a higher version and can tell me if the output matches
what I have.

thanks in advance,
- Markus

-------------------8<--------------------------

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<style type="text/css">
body { margin: 0; padding: 0; }
</style>
<script type="text/javascript">
window.onload = function() {
alert(document.getElementById('scroller').offsetTop);
}
</script>
</head>
<body>
<table>
<tr><td height="100"</td></tr>
<tr>
<td>
<div id="scroller" style="position:relative;">
</div>
</td>
</tr>
</table>
</body>
</html>
 
M

Markus Fischer

Markus said:
When I tested it on 6.0.2600.0000 the output is "209". What?! [...]

What I essentially missed here is, that this was tested on an english
version.

sincerly,
- Markus
 
G

Grant Wagner

Markus said:
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.

When I tested it on 6.0.2600.0000 the output is "209". What?! The
HTML-snipplet below is ripped of from a pretty complex page layout; it's
the bare minimum which reproduces the problem quite well.

My only goal was to find out the exact position of the DIV scroller once
the page is rendered so I can apply some method to emulate a scrolling
mechanism. But this wierd result prevents me from does this. It's
completely useless, I've searched google quite a while but couldn't find
anything.

I hope someone can test this on an english version of XP, maybe with
same version or a higher version and can tell me if the output matches
what I have.

thanks in advance,
- Markus

IE Version 5.50.4522.1800 (English): 209
IE Version 6.0.2800.1106.xpsp2.030422-1633 (English): 105
Firefox 0.9.3: 105
Opera 7.54: 107

It appears somewhere between IE 5.5 and 6.0 Service Pack 1 Microsoft changed
something.

Since you know where the discrepancy occurs, you could use conditional
comments to use another method to obtain the information you want in lower
versions (<url:
http://msdn.microsoft.com/workshop/author/dhtml/overview/ccomment_ovw.asp
/>):

<script type="text/javascript">
// method used by all DOM2 compliant browsers
</script>
<!--[if lt IE 6.0280]>
<script type="text/javascript">
// method used by IE versions less than 6.0.2800
</script>
<![endif]-->

Note, unfortunately it appears the "version vector" and the "6.0.2600 /
6.0.2800" part are different values, because the above uses the conditional
comment section, even on my 6.0.2800.1106 IE. I'm not sure if 6.0.2600 /
6.0.2800 could be targeted independantly using conditional comments, but
it's worth investigating.

The other possibility is to use conditional comments to target IE entirely,
then use proprietary IE techniques to identify the version you want
specifically:

<![if !IE]>
<script type="text/javascript">
// method used by all browsers except IE
</script>
<![endif]>
<!--[if IE]>
<script type="text/javascript">
// method used by IE
// test clientInformation.appMinorVersion
// for the string "SP1" (or something)
</script>
<![endif]-->
 
M

Markus Fischer

Hi,

thanks for getting a reply. I already though this message would get lost ;)

I well know conditional comments, use them quite often. Its just, it
struck to hunt the problem down, actually only could find a small
testcase but not what the real problem ist. I've to use workaround
currently to get this working.

Many thanks for testing this,

cheers,
- Markus
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,190
Latest member
Martindap

Latest Threads

Top