Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • From: alwang at micron.com (alwang@xxxxxxxxxx)
  • Subject: [Javascript] Get the position of the cursor in a textarea?
  • Date: Mon Jun 23 15:42:28 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@xxxxxxxxxxxxxxx]
> Sent: Tuesday, January 29, 2002 10:28 PM
> To: javascript@xxxxxxxxxx
> 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@xxxxxxxxxx
> https://lists.LaTech.edu/mailman/listinfo/javascript
>