By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,984 Members | 1,421 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,984 IT Pros & Developers. It's quick & easy.

Selecting text in a textbox

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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.