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