473,395 Members | 1,530 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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 2344
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: DOTNETGUY | last post by:
What i am doing is pretty simple. I am writing a simple control that you probably have seen on many websites. You have a phone number field ( 3 Textboxes ) if the size of the textbox text is = 3...
4
by: melanieab | last post by:
Hi, I need to write something so that when a textbox is entered (this is for a touchscreen), all the text in that textbox is selected (highlighted) and new keystrokes replace the old text. Help!...
3
by: Harry Simpson | last post by:
I've got a server-side textbox that receives the focus when the page loads. It has the text "Refine your Search" in the textbox. Obviously the user needs to highlight the "Refine your Search"...
3
by: Strange Cat | last post by:
Hi everyone Is it possible to select the contents in an aspnet textbox? (Like the old textbox selectstart and so on properties) Thanx in advance
5
by: marfi95 | last post by:
I'm very confused. I'm trying to automatically select the text when my textbox gets the focus. This is typically when the user has clicked the mouse in the field. This is the code I have in...
4
by: rcoco | last post by:
I want to select one Row from a datagrid so I create a textBbox(txtname) and Button for the user to write the name in textBox and By the click of the button it select the corresponding row. But...
2
by: Abubakar | last post by:
Hi, In a normal Windows.Forms.TextBox control, I want to be able to select a text (ie highlight, this is by default possible) and than be able to drag that text through my mouse pointer to another...
1
by: David C | last post by:
I see that the .Focus() method is new in .NET 2.0, which I think is handy. But is there a way to make text in a textbox selected when the focus is set in it? This would be equivalent to calling...
3
by: Shawn | last post by:
I'm trying to go through a large number of logically named textboxes using a loop and cannot figure out how short of explicitly referencing every single one.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.