How do I have a 'message' follow the mouse cursor as it moves across the browser?

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>
0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact