JavaScript DHTML/Development/Cursor — различия между версиями

Материал из Web эксперт
Перейти к: навигация, поиск
м (1 версия)
 
(нет различий)

Текущая версия на 10:19, 26 мая 2010

Coordinates of the cursor

   <source lang="html4strict">

<html> <head> <script type="text/javascript"> function show_coords(event){

   alert("X coords: " + event.clientX + ", Y coords: " + event.clientY)

} </script> </head> <body onmousedown="show_coords(event)">

Click in the document.

</body> </html>


      </source>
   
  


Coordinates of the cursor relative to the screen

   <source lang="html4strict">

<html> <head> <script type="text/javascript"> function coordinates(event){

   alert("X=" + event.screenX + " Y=" + event.screenY)

} </script> </head> <body onmousedown="coordinates(event)">

Click in the document.

</body> </html>


      </source>
   
  


Hand, help and wait cursor

   <source lang="html4strict">
   

<html> <body> <script language="JavaScript">

   function function1() {
       document.all.Layer1.style.cursor = "hand";
   }
   function function2() {
       document.all.Layer1.style.cursor = "help";
   }
   function function3() {
       document.all.Layer1.style.cursor = "wait";
   }

</script>

Move the mouse over this div element.

<button onclick="function1();">Replace cursor for "hand"</button> <button onclick="function2();">Replace cursor for "help"</button> <button onclick="function3();">Replace cursor for "wait"</button> </body> </html>


     </source>