0 Replies Latest reply: Apr 15, 2010 10:39 AM by DHeadrick RSS

    Can JavaScript determine the cursor line number in a text field?

    DHeadrick Community Member

      Hi,

       

      I'm using JavaScript with Adobe Acrobat 9.  In my program, I'll be attaching to an already-existing text field and would like to take action (display something) based on where the user's cursor is at in the text field.  The text in the text field is larger than the size of the text box so I have to deal with the fact that the text is scrolled.

       

      In any case, is there some way to get the line number where the cursor is currently situated at in a text field?  If the text wasn't scrollable, I presume I could get the cusor (mouse) X-Y position, and figure out the line number associated with the cursor's position.  But, alas, the text is scrollable.

       

      If the line number (where the cursor is at) isn't available, I could still figure things out if I knew how many lines the text had been scrolled.  I could then take the X-Y position of the mouse and figure out what line of text I must be on based on the amount of scrolling that's occurred.

       

      So, I would be happy with either:

       

        1. Some way to figure out what the line number is where my cursor is situated in a text box.

        2. Some way to know how many lines of text have been scrolled.

       

      Thanks for anyone's help!

       

      Dave