IE7 Standards Mode,Mouse X Y position when the window is scrolled up

I'm working on coding a popup box that appears when you put your cursor over a tag.  It uses onmouseover and onmouseout.  I'm having trouble finding the right variable to use to get it to work in IE7 Standards mode when the window has been scrolled up.

I modify the element's style.left and style.top to be equal to the mouse X and Y coordinates.

In IE6 Quirks mode, this finds the right values:

event.clientX + document.body.scrollLeft
event.clientY + document.boy.scrollTop

When this is displayed in IE7 or IE8 standards mode, as you scroll down the page, the X and Y coordinates end up being above where the tag is on the page.  For instance, if you put your cursor over the word "instance" in this sentence, the popup would appear as though you put your cursor over a word in the second paragraph above instead of where your mouse actually is.

In IE8 standards mode, I can use this code:

event.X
event.Y

In IE7 and IE6 quirks mode, it has the same problem as above.

So I have code that will work in IE6 quirks mode, and code that will work in IE8 standards mode.  What I don't have is code that will work in IE7 standards mode.

So, in IE7 standards mode, what can I use to determine the X and Y coordinate for the mouse cursor so that if that value is applied to a tag with it's Left and Top value, it will appear where the mouse is located.

I'm using this doctype:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

I'm using the developer tools with IE8 to change between IE6 quirks mode, IE7 standards mode, and IE8 standards mode.  I'm debugging with VS 2010 when needed.

I've got everything in place for this code wise, I just need to know how to find the mouse coordinates in IE7 standards mode so I'm not looking for a replacement popup script or anything like that.  Just info on how to get the mouse coordinates in IE7 standards mode.

Thanks in advance.
LVL 2
CheckAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CheckAuthor Commented:
Found it.

event.clientX + document.documentElement.scrollLeft
event.clientY + document.documentElement.scrollTop

Works in IE7 standards mode and IE8 standards mode.  That's what I needed.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.