TEXT   10

mouse.txt

Guest on 14th May 2021 12:37:59 AM

  1. http://www.webmasterworld.com/forum21/1904.htm
  2. ___________________
  3. There is a CSS element called 'cursor' you can set to cursor:default.
  4. No need for 'onMouseover' just something like
  5.  
  6. <div style="cursor: default">
  7. <img [insert image(s) here]>
  8. </div>
  9.  
  10. Below are examples of other cursors to play with:
  11.  
  12. cursor: auto
  13. cursor: crosshair
  14. cursor: hand
  15. cursor: move
  16. cursor: e-resize
  17. cursor: ne-resize
  18. cursor: nw-resize
  19. cursor: n-resize
  20. cursor: se-resize
  21. cursor: sw-resize
  22. cursor: s-resize
  23. cursor: w-resize
  24. cursor: text
  25. cursor: wait
  26. cursor: help
  27. _______________
  28.  
  29. As you have specfied I have declared in CSS.
  30.  
  31. I want to the following requirement.
  32.  
  33. When I mouse over the image
  34. first time cursor should be hand.
  35. second time - help
  36. third - crosshair
  37. etc....
  38.  
  39. I want the javascript equivalent of changing the mouse cursor.
  40. _____________________
  41.  
  42. I tested this with IE6 and Moz097.
  43.  
  44. <edit>
  45. made a slight change... "hand" is not w3c (I think its MS only), use "pointer" instead
  46. </edit>
  47.  
  48.  
  49. <html>
  50. <head>
  51. <script type='text/javascript'><!--
  52.  
  53. var d1, c=0;
  54. var cursors = new Array(
  55. 'pointer',
  56. 'default',
  57. 'auto',
  58. 'crosshair',
  59. 'hand',
  60. 'move',
  61. 'e-resize',
  62. 'ne-resize',
  63. 'nw-resize',
  64. 'n-resize',
  65. 'se-resize',
  66. 'sw-resize',
  67. 's-resize',
  68. 'w-resize',
  69. 'text',
  70. 'wait',
  71. 'help'
  72. );
  73.  
  74. window.onload = function() {
  75. d1 = document.getElementById('D1');
  76. d1.onmouseover = doCursor;
  77. }
  78.  
  79. function doCursor() {
  80. window.status = 'cursor: ' + cursors[c];
  81. d1.style.cursor = cursors[c++];
  82. if (c >= cursors.length) c = 0;
  83. }
  84.  
  85. //--></script>
  86. </head>
  87. <body>
  88.  
  89. <span id='D1'>
  90. <img src='myimg.jpg' width='100' height='100'>
  91. </span>
  92.  
  93. </body>
  94. </html>

Raw Paste


Login or Register to edit or fork this paste. It's free.