How do I hide the mouse pointer?

admin

Administrator
Staff member
I was just wondering if anyone out there can send me the code to remove the mouse pointer when people move the mouse into the window? I want to have a crosshair on the page without the standard mouse pointer attached to it.<br />
<br />
Any help, much appreciated.<br />
<br />
Phil<!--content-->well you are not really hiding the cursor, but changing it.<br />
<br />
in the body tag I think this will work<br />
<br />
<body style="cursor:crosshair"><br />
<br />
or something like that.<!--content-->Originally posted by scoutt <br />
well you are not really hiding the cursor, but changing it.<br />
<br />
in the body tag I think this will work<br />
<br />
<body style="cursor:crosshair"><br />
<br />
or something like that. <br />
<br />
Coo...I didn't know that :)<!--content-->why did it work :P<!--content-->Yep :P<!--content-->wooo hooo that is 3 right this year, chew on that :D:D<!--content--><sigh> I'll never catch up now. :rolleyes:<br />
I hate you high-flyers ;)<br />
<br />
Btw, coz I know you'll be dying to know, it degrades gracefully in NS4.x<!--content-->Actually, thats not what i'm after :) I wanted to use the following code, so if anyone can use this code and remove the original mouse pointer from the window, it'd be much appreciated. If u check this code out on a page, you'll realise what I mean.<br />
<br />
To the head, add:<br />
<br />
<style><br />
<!--<br />
#leftright, #topdown{<br />
position:absolute;<br />
left:0;<br />
top:0;<br />
width:1px;<br />
height:1px;<br />
layer-background-color:black;<br />
background-color:black;<br />
z-index:100;<br />
font-size:1px;<br />
}<br />
--><br />
</style><br />
<br />
<br />
<br />
To the body, add:<br />
<br />
<div id="leftright" style="width:expression(document.body.clientWidth-2)"></div><br />
<div id="topdown" style="height:expression(document.body.clientHeight-2)"></div><br />
<br />
<script language="JavaScript1.2"><br />
<!--<br />
<br />
if (document.all&&!window.print){<br />
leftright.style.width=document.body.clientWidth-2<br />
topdown.style.height=document.body.clientHeight-2<br />
}<br />
else if (document.layers){<br />
document.leftright.clip.width=window.innerWidth<br />
document.leftright.clip.height=1<br />
document.topdown.clip.width=1<br />
document.topdown.clip.height=window.innerHeight<br />
}<br />
<br />
<br />
function followmouse1(){<br />
//move cross engine for IE 4+<br />
leftright.style.pixelTop=document.body.scrollTop+event.clientY+1<br />
topdown.style.pixelTop=document.body.scrollTop<br />
if (event.clientX<document.body.clientWidth-2)<br />
topdown.style.pixelLeft=document.body.scrollLeft+event.clientX+1<br />
else<br />
topdown.style.pixelLeft=document.body.clientWidth-2<br />
}<br />
<br />
function followmouse2(e){<br />
//move cross engine for NS 4+<br />
document.leftright.top=e.y+1<br />
document.topdown.top=pageYOffset<br />
document.topdown.left=e.x+1<br />
}<br />
<br />
if (document.all)<br />
document.onmousemove=followmouse1<br />
else if (document.layers){<br />
window.captureEvents(Event.MOUSEMOVE)<br />
window.onmousemove=followmouse2<br />
}<br />
<br />
function regenerate(){<br />
window.location.reload()<br />
}<br />
function regenerate2(){<br />
setTimeout("window.onresize=regenerate",400)<br />
}<br />
if ((document.all&&!window.print)||document.layers)<br />
//if the user is using IE 4 or NS 4, both NOT IE 5+<br />
window.onload=regenerate2<br />
<br />
//--><br />
</script><!--content-->
 
Back
Top