I have some mouse-tracking code that isn't working as expected in IE that basically boils down to the HTML below. I've tried this in both IE7 and IE8.
The part that's unexpected is when you mouse over the text in the disabled textbox, the values for window.event.clientX and clientY seem to be relative to that text instead of the whole window.
Can anyone explain why in this scenario, the values should be relative to the text instead of the whole window?
I guess I can likely find a workaround, but it just really surprised me.
<html>
<body>
window.event.clientX: <br />
<input type="text" id="foo">
<input type="text" value="mouse over me" disabled />
</body>
<script>
function trackMouse() {
document.getElementById('foo').value = window.event.clientX;
}
document.onmousemove = trackMouse;
</script>
</html>