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

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

P: n/a
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').offsetTo p);
}
</script>
</head>
<body>
<table>
<tr><td height="100"</td></tr>
<tr>
<td>
<div id="scroller" style="position:relative;">
</div>
</td>
</tr>
</table>
</body>
</html>
Jul 23 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Markus Fischer wrote:
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
Jul 23 '05 #2

P: n/a
Markus Fischer wrote:
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/a...omment_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]-->

--
Grant Wagner <gw*****@agricoreunited.com>
comp.lang.javascript FAQ - http://jibbering.com/faq

Jul 23 '05 #3

P: n/a
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
Jul 23 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.