Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Javascript] Javascript Question
- From: javascript@xxxxxxxxxx (Matt Bushman)
- Subject: [Javascript] Javascript Question
- Date: Wed, 25 Sep 2002 15:53:34 -0500
This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C264D5.9CE89790 Content-Type: text/plain Did you ever figure out how to get the cursor position in a textarea field???? Let me know... Your message below: 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:HYPERLINK "mailto:costea.dan@xxxxxxxxxxxxxxx"costea.dan@xxxxxxxxxxxxxxx <mailto:HYPERLINK > ] > Sent: Tuesday, January 29, 2002 10:28 PM > To: javascript@xxxxxxxxxx <mailto: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 Matt Bushman, IT Analyst Rochester Public Utilities 4000 East River Road NE Rochester, MN 55906 Phone: 507-280-1536 Email: msbushman@xxxxxxx ------_=_NextPart_001_01C264D5.9CE89790 Content-Type: text/html Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <HTML> <HEAD> <META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; = charset=3Dus-ascii"> <META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version = 5.5.2650.12"> <TITLE>Javascript Question</TITLE> </HEAD> <BODY> <P><FONT SIZE=3D2 FACE=3D"Arial">Did you ever figure out how to get the = cursor position in a textarea field????</FONT> </P> <P><FONT SIZE=3D2 FACE=3D"Arial">Let me know...</FONT> </P> <P><FONT SIZE=3D2 FACE=3D"Arial">Your message below:</FONT> </P> <P><FONT FACE=3D"Times New Roman">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).</FONT></P> <P><FONT FACE=3D"Times New Roman"> David ><I> -----Original = Message-----</I> ><I> From: Dan Costea [</I></FONT><A = HREF=3D"mailto:HYPERLINK "><I><U><FONT COLOR=3D"#0000FF" FACE=3D"Times = New Roman">mailto:HYPERLINK = "mailto:costea.dan@xxxxxxxxxxxxxxx"</FONT></U><U><FONT = COLOR=3D"#0000FF" FACE=3D"Times New = Roman">costea.dan@xxxxxxxxxxxxxxx</FONT></U></I><I></I></A><I></I><I><FO= NT FACE=3D"Times New Roman">]</FONT></I> <FONT FACE=3D"Times New = Roman">></FONT><I><FONT FACE=3D"Times New Roman"> Sent: Tuesday, = January 29, 2002 10:28 PM</FONT></I> <FONT FACE=3D"Times New = Roman">></FONT><I><FONT FACE=3D"Times New Roman"> To: </FONT></I><A = HREF=3D"mailto:javascript@xxxxxxxxxx"><I></I><I><U><FONT = COLOR=3D"#0000FF" FACE=3D"Times New = Roman">javascript@xxxxxxxxxx</FONT></U></I><I></I></A><I></I><I><FONT = FACE=3D"Times New Roman"></FONT></I> <FONT FACE=3D"Times New = Roman">></FONT><I><FONT FACE=3D"Times New Roman"> Subject: Re: = [Javascript] Get the position of the cursor in a</FONT></I> <FONT = FACE=3D"Times New Roman">></FONT><I><FONT FACE=3D"Times New Roman"> = textarea?</FONT></I> <FONT FACE=3D"Times New Roman">></FONT><I><FONT = FACE=3D"Times New Roman"></FONT></I> <FONT FACE=3D"Times New = Roman">></FONT><I><FONT FACE=3D"Times New Roman"></FONT></I> <FONT = FACE=3D"Times New Roman">></FONT><I><FONT FACE=3D"Times New Roman"> = Yes, it is possible. I didn't made the code for NS, but with</FONT></I> = <FONT FACE=3D"Times New Roman">></FONT><I><FONT FACE=3D"Times New = Roman"> IE4+ you can</FONT></I> <FONT FACE=3D"Times New = Roman">></FONT><I><FONT FACE=3D"Times New Roman"> run the following = code:</FONT></I> <FONT FACE=3D"Times New Roman">></FONT><I><FONT = FACE=3D"Times New Roman"></FONT></I> <FONT FACE=3D"Times New = Roman">></FONT><I><FONT FACE=3D"Times New Roman"> <body = onMouseMove=3D"document.all['asdf'].innerHTML =3D 'xPos: = '</FONT></I> <FONT FACE=3D"Times New Roman">></FONT><I><FONT = FACE=3D"Times New Roman"> + event.x +</FONT></I> <FONT FACE=3D"Times = New Roman">></FONT><I><FONT FACE=3D"Times New Roman"> = '<br>yPos: ' + event.y "></FONT></I> <FONT FACE=3D"Times = New Roman">></FONT><I><FONT FACE=3D"Times New Roman"> <div = id=3D"asdf"></div></FONT></I> <FONT FACE=3D"Times = New Roman">></FONT><I><FONT FACE=3D"Times New Roman"> = <br></FONT></I> <FONT FACE=3D"Times New = Roman">></FONT><I><FONT FACE=3D"Times New Roman"> <textarea = rows=3D4 cols=3D35>this is a textarea ... = </textarea></FONT></I> <FONT FACE=3D"Times New = Roman">></FONT><I><FONT FACE=3D"Times New Roman"> = </body></FONT></I> <FONT FACE=3D"Times New = Roman">></FONT><I><FONT FACE=3D"Times New Roman"></FONT></I> <FONT = FACE=3D"Times New Roman">></FONT><I><FONT FACE=3D"Times New = Roman"></FONT></I> <FONT FACE=3D"Times New Roman">></FONT><I><FONT = FACE=3D"Times New Roman"></FONT></I> <FONT FACE=3D"Times New = Roman">></FONT><I><FONT FACE=3D"Times New Roman"></FONT></I> <FONT = FACE=3D"Times New Roman">></FONT><I><FONT FACE=3D"Times New = Roman"></FONT></I> <FONT FACE=3D"Times New Roman">></FONT><I><FONT = FACE=3D"Times New Roman"> > Hi all. Is it possible to get the = position of the cursor</FONT></I> <FONT FACE=3D"Times New = Roman">></FONT><I><FONT FACE=3D"Times New Roman"> in a = textarea?</FONT></I> <FONT FACE=3D"Times New Roman">></FONT><I><FONT = FACE=3D"Times New Roman"> > E.g. let's say I have:</FONT></I> <FONT = FACE=3D"Times New Roman">></FONT><I><FONT FACE=3D"Times New Roman"> = ></FONT></I> <FONT FACE=3D"Times New Roman">></FONT><I><FONT = FACE=3D"Times New Roman"> > Hello there, Welcome to 12345 = company.</FONT></I> <FONT FACE=3D"Times New Roman">></FONT><I><FONT = FACE=3D"Times New Roman"> ></FONT></I> <FONT FACE=3D"Times New = Roman">></FONT><I><FONT FACE=3D"Times New Roman"> > in a = textarea, and the cursor is currently after the word</FONT></I> <FONT = FACE=3D"Times New Roman">></FONT><I><FONT FACE=3D"Times New Roman"> = Hello. So I</FONT></I> <FONT FACE=3D"Times New = Roman">></FONT><I><FONT FACE=3D"Times New Roman"> would</FONT></I> = <FONT FACE=3D"Times New Roman">></FONT><I><FONT FACE=3D"Times New = Roman"> > like a value of 6 returned by such a javascript function. = Thanks!</FONT></I> <FONT FACE=3D"Times New Roman">></FONT><I><FONT = FACE=3D"Times New Roman"> ></FONT></I> <FONT FACE=3D"Times New = Roman">></FONT><I><FONT FACE=3D"Times New Roman"> > = David</FONT></I> </P> <BR> <P><B><FONT COLOR=3D"#800000" SIZE=3D2 FACE=3D"Arial">Matt = Bushman,</FONT> <FONT COLOR=3D"#000080" SIZE=3D2 FACE=3D"Arial">IT = Analyst</FONT></B> <BR><B><FONT COLOR=3D"#000000" SIZE=3D2 FACE=3D"Arial">Rochester Public = Utilities</FONT></B> <BR><B><FONT COLOR=3D"#000000" SIZE=3D2 FACE=3D"Arial">4000 East River = Road NE</FONT></B> <BR><B><FONT COLOR=3D"#000000" SIZE=3D2 FACE=3D"Arial">Rochester, MN = 55906</FONT></B> <BR><B><FONT COLOR=3D"#800000" SIZE=3D2 = FACE=3D"Arial">Phone:</FONT><FONT SIZE=3D2 FACE=3D"Arial"> </FONT><FONT = COLOR=3D"#000080" SIZE=3D2 FACE=3D"Arial">507-280-1536</FONT></B> <BR><B><FONT COLOR=3D"#800000" SIZE=3D2 = FACE=3D"Arial">Email:</FONT><FONT SIZE=3D2 FACE=3D"Arial"> </FONT><FONT = COLOR=3D"#000080" SIZE=3D2 FACE=3D"Arial">msbushman@xxxxxxx</FONT></B> </P> </BODY> </HTML> ------_=_NextPart_001_01C264D5.9CE89790--
- Prev by Date: [Javascript] Add 10 working days.
- Next by Date: [Javascript] Passing Selection Data
- Previous by thread: [Javascript] Add 10 working days.
- Next by thread: [Javascript] Passing Selection Data
- Index(es):