Results 1 to 6 of 6

Thread: mouse cursor

  1. #1
    Join Date
    Jul 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cool mouse cursor

    after creating the crosshair http://www.dynamicdrive.com/dynamici.../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?

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    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:
    Code:
    if (document.all)
    document.onmousemove=followmouse1
    else if (document.layers){
    window.captureEvents(Event.MOUSEMOVE)
    window.onmousemove=followmouse2
    }
    Make it like this:
    Code:
    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:
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Jul 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up

    thanks for the help, it works great!

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

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    What do you mean by insert new buttons? How is this done?
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Jul 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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

  6. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    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:
    Code:
    <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>
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •