PDA

View Full Version : mouse cursor



iknowu99
07-22-2005, 02:06 PM
after creating the crosshair http://www.dynamicdrive.com/dynamicindex13/crosshair.htm I am having difficulties hiding the actual mouse cursor. Over some objects I will see the hand over other objects I will see the 'I' when there is typing involved.

Anybody know how to fix this?

jscheuer1
07-22-2005, 08:39 PM
The demo does the same thing. The only way I know of is to set the cursor style for all elements. In IE you can use a blank custom cursor. The script, as currently written, only works in IE and NS4 (no one uses NS4 anymore) anyways, so where it says:

if (document.all)
document.onmousemove=followmouse1
else if (document.layers){
window.captureEvents(Event.MOUSEMOVE)
window.onmousemove=followmouse2
}Make it like this:

if (document.all){
if (document.getElementsByTagName){
var allCursors=document.getElementsByTagName('*')
for (i = 0; i < allCursors.length; i++)
allCursors[i].style.cursor="url('blank.cur'),crosshair"
}
document.onmousemove=followmouse1
}
else if (document.layers){
window.captureEvents(Event.MOUSEMOVE)
window.onmousemove=followmouse2
}You will need blank.cur (place it the same directory as your file), it is attached inside of blank.zip below:

iknowu99
07-26-2005, 03:24 PM
thanks for the help, it works great!

the single problem is when I insert new buttons the original mouse cursor appears over these buttons. :confused:

jscheuer1
07-26-2005, 04:13 PM
What do you mean by insert new buttons? How is this done?

iknowu99
07-26-2005, 08:32 PM
sorry, dont know the terminology when it comes to programming (a statistician by nature)

I inserted code like:

<a href="mailto:blah@psu.edu">E-mail</a> </td>
and here it showes the hand cursor (as well as the crosshair)

<p align="center"><input type="submit" value="pictures" name="B1" onClick="FUNCTION()">
here it showes the regular pointer
the crosshair doesnt go away as well, so thats good but the blank cursor doesnt replace the pointer

jscheuer1
07-26-2005, 08:50 PM
What a relief, I thought you might be creating elements on the fly via the DOM. Looks like we need an onload event. Remove the code we added earlier and put this script in the head:

<script type="text/javascript">
function blankCur(){
if (document.getElementsByTagName){
var allCursors=document.getElementsByTagName('*')
for (i = 0; i < allCursors.length; i++)
allCursors[i].style.cursor="url('blank.cur'),crosshair"
}
}

if ( typeof window.attachEvent != "undefined" ) {
window.attachEvent( "onload", blankCur );
}
</script>