473,385 Members | 1,597 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,385 software developers and data experts.

Auto highlight text in textbox/area

8
Hi

This is probably simple but I cant find it on the net. I want to highlight the text in a text area when the user clicks the area. I presume its onclick = something. But I dont know what. Can anyone help?
Cheers
Aug 2 '07 #1
4 5486
drhowarddrfine
7,435 Expert 4TB
The only way possible, with CSS, is:
<style type="text/css">
textarea:focus{background-color:yellow}
</style>

</head>
<body>
<textarea>hello</textarea>

which will highlight the background. Change it to 'color:red' and that will change the font color. As usual, this only works in modern browsers and not any version of IE.

Otherwise, this is a javascript solution.
Aug 2 '07 #2
daithi
8
Unfortuantely the users this is intended for use a mix of IE and others. Have you any idea of the Javacript solution?
Aug 2 '07 #3
drhowarddrfine
7,435 Expert 4TB
No. You need to ask in the javascript area. I'll transfer this there.
Aug 2 '07 #4
acoder
16,027 Expert Mod 8TB
Hi

This is probably simple but I cant find it on the net. I want to highlight the text in a text area when the user clicks the area. I presume its onclick = something. But I dont know what. Can anyone help?
Cheers
You could try something like:
[HTML]<textarea onclick="this.style.color='red'">Test</textarea>[/HTML]
Aug 2 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Cox | last post by:
How would I go about highlighting text in a textbox?
0
by: Alex Moskalyuk | last post by:
I am using System.Windows.Forms.TextBox to publish some real-time data that's coming off the external devices. My data is fed into the TextBox with proper precautions not to exceed the MaxSize...
0
by: Chris Fink | last post by:
I am having a problem highlighting a row in a datalist during the itemdatabound event. What is occurring is that a new td row is being wrapped around the datalist item which is highlighted (very...
0
by: 23s | last post by:
Is there any way I can send a vertical value to a form's scroll position? I have a full-screen form that, at launch, contains an empty tab sheet. At run time, the user can dynamically append a...
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...
11
by: eureka | last post by:
Hi All, I'm training in Servlets, JSP and JavaScript, I have a web page in which there's a "StudentName" textbox and below it is a "Names" Dropdown list. Initially the Textbox is empty and...
2
by: Number 11950 - GPEMC! Replace number with 11950 | last post by:
When you highlight a selection of text represented in an object on a form, somewhere in the Framework or alternatively in the Windows API there exists an array of variables that either contain as a...
7
by: sphinney | last post by:
I have a datasheet style form with textbox (MyTextBox) that has the Text Format property set to "Rich Text". It is bound to a memo field in a table. How do I change the text or highlight color of...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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.