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: J.Kahmann at fcj.hvu.nl (Joost Kahmann)
- Subject: [Javascript] Get the position of the cursor in a textarea?
- Date: Tue Jun 24 04:40:51 2003
Hi All
Try this:
function zetFocus()
{
this.f_int.Naam.focus() ;
}
<body onLoad="zetFocus(0,1);">
'F_int' is the name of the form.
'Naam' is the name of the focussed element.
_
/\_\
\/_/ Joost
> ----------
> From: alwang@xxxxxxxxxx
> Reply To: [JavaScript List]
> Sent: maandag, 23 juni 2003 22:42
> To: Javascript@xxxxxxxxxx
> Subject: [Javascript] Get the position of the cursor in a textarea?
>
>
> 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
> >
>
> _______________________________________________
> Javascript mailing list
> Javascript@xxxxxxxxxx
> https://lists.LaTech.edu/mailman/listinfo/javascript
>
>
- Prev by Date: [Javascript] Get the position of the cursor in a textarea?
- Next by Date: [Javascript] in response to "add a new entry in a drop down menu"
- Previous by thread: [Javascript] Get the position of the cursor in a textarea?
- Next by thread: [Javascript] Get the position of the cursor in a textarea?
- Index(es):