470,590 Members | 2,267 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,590 developers. It's quick & easy.

Selecting text in a textbox

JJ
I have a textbox that is used to insert some html code. I want to highlight
errors in the code, possibly by selecting the text.

Is it possible to highlight/select areas of a textbox programmatically?

Thanks,

JJ
Jun 12 '07 #1
2 2251
On 12 juin, 12:40, "JJ" <a...@xyz.comwrote:
I have a textbox that is used to insert some html code. I want to highlight
errors in the code, possibly by selecting the text.

Is it possible to highlight/select areas of a textbox programmatically?

Thanks,

JJ
It's possible use :
textbox.select()
Omar Abid

Jun 12 '07 #2
You can select only one block of text in a web page, as the web page has
only one selection object, regardless of the browser. So, yes, you can
select text in a textbox using JavaScript. It's not easy, but it can be
done. How it is done depends on the client browser, as IE and Mozilla have
different implementations of the selection object and the range ("TextRange"
in IE) object.

Here are a couple of articles that deal with the subject with IE and FireFox
respectively:

http://www.bazon.net/mishoo/articles.epl?art_id=1292
http://www.dotvoid.com/view.php?id=11

--
HTH,

Kevin Spencer
Microsoft MVP

Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net

"JJ" <ab*@xyz.comwrote in message
news:u9**************@TK2MSFTNGP04.phx.gbl...
>I have a textbox that is used to insert some html code. I want to highlight
errors in the code, possibly by selecting the text.

Is it possible to highlight/select areas of a textbox programmatically?

Thanks,

JJ

Jun 12 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by DOTNETGUY | last post: by
4 posts views Thread by melanieab | last post: by
3 posts views Thread by Harry Simpson | last post: by
3 posts views Thread by Strange Cat | last post: by
5 posts views Thread by marfi95 | last post: by
4 posts views Thread by rcoco | last post: by
2 posts views Thread by Abubakar | last post: by
1 post views Thread by David C | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.