[Javascript] Get the position of the cursor in a textarea?

alwang at micron.com alwang at micron.com
Mon Jun 23 15:42:23 CDT 2003


David, 
   I also have such problem, how do you fix this problem?

    Thanks,

Alex.


Dan- I just tried it and it actually gives the position of the mouse and not
the blinking text cursor (sorry I didn't make that clear).  

David

> -----Original Message-----
> From: Dan Costea [mailto:costea.dan at ssi-schaefer.ro]
> Sent: Tuesday, January 29, 2002 10:28 PM
> To: javascript at LaTech.edu
> Subject: Re: [Javascript] Get the position of the cursor in a 
> textarea?
> 
> 
> Yes, it is possible. I didn't made the code for NS, but with 
> IE4+ you can
> run the following code:
> 
> <body onMouseMove="document.all['asdf'].innerHTML = 'xPos: ' 
> + event.x +
> '<br>yPos: ' + event.y ">
> <div id="asdf"></div>
> <br>
> <textarea rows=4 cols=35>this is a textarea ... </textarea>
> </body>
> 
> 
> 
> 
> 
> > Hi all.  Is it possible to get the position of the cursor 
> in a textarea?
> > E.g. let's say I have:
> >
> > Hello there, Welcome to 12345 company.
> >
> > in a textarea, and the cursor is currently after the word 
> Hello.  So I
> would
> > like a value of 6 returned by such a javascript function.  Thanks!
> >
> > David
> > _______________________________________________
> 
> 
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
> 



More information about the Javascript mailing list