thegentleman
IS-IT--Management
I have a fairly simple piece of code that displays a small description window when you roll over certain glossary words - the window is positioned wherever your mouse sits on the page:
This worked perfectly until I added the DOCTYPE to the top of the page:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"
Now the window pops up in quite random places and it doesn't seem to follow the user scrolling down the page.
Any ideas?
~tg
Code:
function moveElement(element) {
var e = window.event;
if (e.pageX || e.pageY) {
MouseX = e.pageX;
MouseY = e.pageY;
}
else if (e.clientX || e.clientY) {
MouseX = e.clientX + document.body.scrollLeft + "px";
MouseY = e.clientY + document.body.scrollTop + "px";
}
theElement = document.getElementById(element);
theElement.style.top = MouseY;
theElement.style.left = MouseX;
}
This worked perfectly until I added the DOCTYPE to the top of the page:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"
Now the window pops up in quite random places and it doesn't seem to follow the user scrolling down the page.
Any ideas?
~tg