How do I have a 'message' follow the mouse cursor as it moves across the browser?
Created May 4, 2012
Jayesh Nazre Here's the entire HTML code which works on NS4/IE5:
<html>
<head>
<script language=javascript>
function test(e) {
var tp;
var eventref;
if (!NS4) {
tp = document.all("id_div");
eventref = event;
tp.style.top = eventref.clientY;
tp.style.left = eventref.clientX;
window.status = eventref.clientX + " : " + eventref.clientY;
} else {
eventref = e;
tp = document.layers["id_div"];
tp.top = eventref.pageY;
tp.left = eventref.pageX;
window.status = eventref.pageX + " : " + eventref.pageY;
}
}
var NS4 = (document.layers) ? 1 : 0;
if (!NS4) {
document.onmousemove=test;
} else {
window.captureEvents(Event.MOUSEMOVE);
window.onmousemove=test;
}
</script>
</head>
<body>
<div name=id_div id=id_div
STYLE="position: absolute; top: 100px; left: 50px; visibility : visible">
Go jGuru!!!
</div>
</body>
</html>