SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    Bored One boredboi's Avatar
    Join Date
    Jul 2000
    Posts
    238
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    how do you retrieve the mouse cursor coordinates with Javascript?

    the only method i know works only with ie... how do you make it compatible with opera, netscape 6 and netscape 4.7?

    i was thinking of using overLIB, but it has too many extra features - i just need the popup without any extra options. overLIB is 7 kb... thats too big.

    thanks.

  2. #2
    I believe you have my stapler. scrubz's Avatar
    Join Date
    Feb 2001
    Location
    Van down by the river
    Posts
    254
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can't guarantee Opera compatibility, but this works for NS 4.x, NS 6, and IE.

    <html>
    <head>
    <script language="JavaScript"><!--
    if (document.layers) document.captureEvents(Event.MOUSEMOVE);
    document.onmousemove=mtrack;

    function mtrack(e) {
    var Text= 'Coordinates: ';
    if (document.layers) Text += e.pageX+','+e.pageY
    else Text += event.x+','+event.y;
    window.status= Text;
    }
    //--></script>
    </head>
    <body>
    Move the mouse and see the status change
    </body>
    </html>

  3. #3
    Bored One boredboi's Avatar
    Join Date
    Jul 2000
    Posts
    238
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thank you so much...
    you deserve a sitepoint....

    but it isn't implemented yet... so i can't give you any..


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
  •