![]() |
|
#1
|
|||
|
|||
|
Is it possible to create a selection of a substring of an input? [code:ihehgnal80] anInput.select() // select the text in the input. // Want to do something like this. anInput.selectSubstring(4,8) // select characters 4-8.[/code:ihehgnal80] I could not think of any way to do it via the dom and could not find any info on this. http://www.w3.org/TR/DOM-Level-2-HTM...t-binding.html I think there is probably browser-specific ways to do it for moz and for IE, but I don't know. http://dhtmlkitchen.com/ - The best DHTML website! |
|
#2
|
|||
|
|||
|
Why aren't you just accessing the input.value and treating it as a string? Am I being dumb?
<font face="Courier New"><font color="maroon">»» Dan »» http://pupius.co.uk || http://13thparallel.org</font id="maroon"></font id="Courier New"> |
|
#3
|
|||
|
|||
|
TextRange
http://msdn.microsoft.com/library/de..._textrange.asp -- Regards, Tim Scarfe <dc@developer-x.com> http://www.developer-x.com http://www.dotnetsolutions.ltd.uk |
|
#4
|
|||
|
|||
|
Seems I was
<font face="Courier New"><font color="maroon">»» Dan »» http://pupius.co.uk || http://13thparallel.org</font id="maroon"></font id="Courier New"> |
|
#5
|
|||
|
|||
|
Not at all dan he just needed a visual selection.
-- Regards, Tim Scarfe <dc@developer-x.com> http://www.developer-x.com http://www.dotnetsolutions.ltd.uk |
|
#6
|
|||
|
|||
|
That's about what I was looking for, I think.
I checked out the DOM Range object in Moz and couldn't get what I wanted out of the input element. I think the "node contents' does not include the value of the input's value attribute. I don't even wanna try using a textarea. It just doesn't seem right. So I made a list box (ala the combobox on webfx) and I wanted to have a selection so that when you press the down arrow key to highlight the next item, the input's value is "tentatively" changed with a selection of the part that you arrow-keyed to (but did not type), minus what you typed. So if you type: "co" it would give you the dropdown list and you could push the down arrow key to go to "colorado bulldog". The text input would have the value "colorado bulldog" and the selection would be "lorado bulldog". [code:380dqf4ekb] +--------------------------------+ | <font color="navy">co</font id="navy"><font color="green">lorado bulldog</font id="green"> | ↓| <font color="red"><-- user typed "co"</font id="red"> +--------------------------------+ +------------------------------+ | <font color="green">colorado bulldog</font id="green"> | <font color="red"><-- User keybd nav'd to this one,</font id="red"> | columbian food | <font color="red">causing the text input to have a tentative </font id="red"> +------------------------------+ <font color="red">selection of "lorado bulldog".</font id="red"> [/code:380dqf4ekb] I thought it was a cool little tweak to add to it, but it looks like it'll be a hassle to implement it. http://dhtmlkitchen.com/ - The best DHTML website! |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|