Home All Groups Group Topic Archive Search About

Is it possible to get only the "Selected" text out of a TextBox

Author
22 Jun 2006 6:05 PM
Chris Bates
Ok guys, here is what I am trying to do.

Lets say I have a TexBox server control on a page.

Lets say that TextBox has a bunch of text in it.

Lets say that a user uses thier mouse to select a small part of the text
then hits a button.

I would like to be able on that button push to trap / get only the text the
user has selected.

Anyone have any ideas, I am coming up with nothing on google.

Thanks

Chris

Author
23 Jun 2006 6:48 AM
Alessandro Zifiglio
hi Chris,
You are looking at writing some javascript to exclude the unselected text in
your textbox when your submit button is clicked, that should populate the
forms collection with the updated value in the textbox before the submit
occurs.
The following link might help you get started with the js you need to write.
http://www.quirksmode.org/js/selected.html
Good luck,
Alessandro Zifiglio
Show quoteHide quote
"Chris Bates" <ChrisBa***@discussions.microsoft.com> ha scritto nel
messaggio news:AB4CEA3D-682F-47F0-96BF-2DAE2BAEE5E7@microsoft.com...
> Ok guys, here is what I am trying to do.
>
> Lets say I have a TexBox server control on a page.
>
> Lets say that TextBox has a bunch of text in it.
>
> Lets say that a user uses thier mouse to select a small part of the text
> then hits a button.
>
> I would like to be able on that button push to trap / get only the text
> the
> user has selected.
>
> Anyone have any ideas, I am coming up with nothing on google.
>
> Thanks
>
> Chris