Solved

offsetTop working in IE7 but not with IE6

Posted on 2007-03-31
4
2,050 Views
Last Modified: 2013-12-08
Hello,

I'm developing a web site, I'm using IE7 on my development computer and everything is working fine. I had to test with IE 6, and something is not right. Here is a summary of the issue.

I got an image displayed in a DIV and I got mouse events on the image.  On mouse down and mousemove, I will draw items in an invisible div over the image (that works perfectly in both versions of IE), but the problem occurs on MouseUp.  The MouseUp will trigger on my "drawing form" (and not my image). I told myself, no worry since the image and the drawing canvas is the same size, I use the clientX and clientY with some calculation using the offsetLeft and offsetTop to get the coordinate relative to my image. This work fine with IE7.  But in IE6 the offsetTop isn't giving the right information!

The IE7 will give me the correct offset of my image and his parent. But in IE6, there is 69 pixels more when looking at the offset of the parent.  That means the calculation is off of 69pixels!

My question is the following: is there any way to get the correct offsetTop from IE6 ?  Or is there any properties I should be looking at to get that information?
0
Comment
Question by:TelDig
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 19

Expert Comment

by:mrwad99
ID: 18829646
This problem was mentioned a while back on EchoEcho:  http://forum.echoechoplus.com/showthread.php?s=398d90d6eb731bc7570a4062954403c1&threadid=9667

Interesting image about how offsetTop is apparently calculated too.  

Maybe this will help.
0
 

Author Comment

by:TelDig
ID: 18832078
I saw this post earlier, and I agree about the image, it is interesting.  But it doesn't solve the problem.  IE7 will give me (in my case) 80 pixels of offsetTop while IE6 gives me 149px.  I'm using the same code on both platform (obviously).

I found that it is a known bug in IE6 (kb: 811808 - http://support.microsoft.com/kb/811808).  I noticed (a little too late that the computer  where I did some tests was not up to date with the windows update. I'm in the process of updating it hoping it may solve the problem.

Thanks for your time.
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 19544718
PAQed with points refunded (500)

Computer101
EE Admin
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
How to create a custom search shortcut to site-search Experts Exchange using Google in the Firefox browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch your Bookmark Menu: Press 'Ctrl +…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question