Javascript Cursor move effects


<script type="text/javascript">
var swidth = (screen.width)-60;
var sheight = (screen.height)-200;
var x, y;
window.onload = init;

document.write("<div id=test style=\"position:absolute;visibility:visible;left:0px;top:0px;width:1px;height:1px; color: red; font-weight: bold;\">\
Hai\
</div>");
document.write("<div id=test2 style=\"position:absolute;visibility:visible;left:0px;top:0px;width:1px;height:1px; color: red; font-weight: bold;\">\
Hai\
</div>");
document.write("<div id=test3 style=\"position:absolute; visibility:visible; left: "+swidth+"px;top:0px;width:1px;height:1px; color: red; font-weight: bold;\">\
Hai\
</div>");

function init() {
if (window.Event) {
document.captureEvents(Event.MOUSEMOVE);
}
document.onmousemove = getXY;
}

function getXY(e) {
x = (window.Event) ? e.pageX : event.clientX;
y = (window.Event) ? e.pageY : event.clientY;

if(x < swidth)
document.getElementById("test").style.left = x+"px";
if(y < sheight)
{
document.getElementById("test2").style.top = y+"px";
document.getElementById("test3").style.top = y+"px";
}
}
</script>