Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #9780

Re: Input Controls

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail
From Norman Peelman <npeelmandog@cfl.rr.com>
Newsgroups comp.lang.javascript
Subject Re: Input Controls
Date Fri, 30 Dec 2011 06:40:36 -0500
Organization A noiseless patient Spider
Lines 43
Message-ID <jdk7vm$inq$1@dont-email.me> (permalink)
References <sk5qf7h79vi3f5v6u1rnapq4t5e5020h8d@4ax.com>
Reply-To npeelmandog@cfl.rr.com
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
Injection-Date Fri, 30 Dec 2011 11:40:38 +0000 (UTC)
Injection-Info mx04.eternal-september.org; posting-host="5CAfWdfEg3xgXs+42nSFEg"; logging-data="19194"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/XmyabaHHv8lS/aH9tyn2Ny7HRhWJUFQ8="
User-Agent Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.23) Gecko/20110921 Thunderbird/3.1.15 ThunderBrowse/3.8
In-Reply-To <sk5qf7h79vi3f5v6u1rnapq4t5e5020h8d@4ax.com>
Cancel-Lock sha1:ys8/KOp8ZVy3o75D6mvRPdG07QI=
Xref x330-a1.tempe.blueboxinc.net comp.lang.javascript:9780

Show key headers only | View raw


On 12/29/2011 09:11 PM, Gene Wirchenko wrote:
> Dear JavaScripters:
>
>       I have some fine points that I would like to know how to do in
> JavaScript.  I do not know that they are even possible.  Having them
> would make data entry much easier.
>
>    1) Position to a particular point in a control's value.  For
> example, if entering a date, it could be much more user-friendly if,
> when the control gets focus, the cursor were positioned just before
> the days as in:
>            201112@29
> where the at-sign represents the cursor.  (In my app-to-be, the date
> is usually in the current month, but not always.)
>
>    2) I want to be able to programmatically select part of an input
> control value.  e.g.  Click on some part of the sentence below and
> have that word and only that word selected
>            The quick, brown fox jumps over the lazy dog.
>                        ^
>            The quick, brown fox jumps over the lazy dog.
>                       ===== selected
> or have the day of a date selected but not the rest.
>
> Sincerely,
>
> Gene Wirchenko
>

   Yes, it is possible. You need to look up 'selection' and 'range' in 
respect to 'javascript'. As a quickly googled example, take a look at:

http://www.quirksmode.org/dom/range_intro.html

...and scroll down (about 3/4 page) to 'Creating a Range object from a 
Selection object'

for some example code.

-- 
Norman
Registered Linux user #461062
AMD64X2 6400+ Ubuntu 10.04 64bit

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Input Controls Gene Wirchenko <genew@ocis.net> - 2011-12-29 18:11 -0800
  Re: Input Controls Norman Peelman <npeelmandog@cfl.rr.com> - 2011-12-30 06:40 -0500
  Re: Input Controls Martin Honnen <mahotrash@yahoo.de> - 2011-12-30 12:57 +0100
  Re: Input Controls "Mel Smith" <med_cutout_syntel@aol.com> - 2011-12-30 10:49 -0700
  Re: Input Controls RobG <rgqld@iinet.net.au> - 2011-12-31 15:21 -0800

csiph-web