SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    FBI secret agent digitman's Avatar
    Join Date
    Sep 2004
    Location
    Work
    Posts
    697
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Getting cursor positon in javascript

    How can I get the current cursor position via javascript? I need it so I can insert a string at the current cursor position.

    Please help!

  2. #2
    SitePoint Evangelist bals28mjk's Avatar
    Join Date
    Aug 2007
    Posts
    405
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    clientX and clientY e.g.
    Code JavaScript:
    document.onclick = pos
    function pos(evt){
    evt?evt:evt=event
    alert("clientX: " + evt.clientX + "\n" + "clientY: " + evt.clientY)
    }


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
  •