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

how to change the color of the text

P: 53
hi to all

when ever i am setting the text field propery as disabled the color of the text is not that much clear to read. thats why i am requesting you people how can i chang color of dissabled text field.

regards
Apr 4 '07 #1
Share this Question
Share on Google+
11 Replies


drhowarddrfine
Expert 5K+
P: 7,435
In what way are you doing this? Show the code.
Apr 4 '07 #2

P: 53
here is my code

Expand|Select|Wrap|Line Numbers
  1. <HTML><BODY><br><br>
  2. NORMAL TEXT FIELD<input type=text value="NORMAL TEXT FIELD"><br><br>
  3. DISABLED TEXT FIELD<input type=text value="DISSABLED TEXT FIELD" disabled>
  4. </BODY>
  5. </HTML>
  6.  
see the difference i am using windows xp. the clarity of the text is not visible thats why i want to chang color of the text. is possible

regards
In what way are you doing this? Show the code.
Apr 4 '07 #3

KevinADC
Expert 2.5K+
P: 4,059
maybe "readonly" will be more appropriate than "disabled".
Apr 4 '07 #4

Expert 100+
P: 1,892
maybe "readonly" will be more appropriate than "disabled".
Kevins got it add readonly="readonly" to the text box. Also, you may want to include the <form> tag to those input boxes if you are planning on doing some action with them.
Apr 4 '07 #5

P: 1
how to change the text box colour using html/javascript.
once u move ur mouse pointer on text field or u click on text field , then color of text field shuold change
Dec 22 '07 #6

gits
Expert Mod 5K+
P: 5,343
how to change the text box colour using html/javascript.
once u move ur mouse pointer on text field or u click on text field , then color of text field shuold change
hi ...

in case you want a pure css-solution you may have a look at the following simple example:

[HTML]<html>
<head>
<style type="text/css">
input#my_tb:hover, input#my_tb:focus {
border: 1px solid red;
background-color: lightyellow;
color: red;
}
</style>
</head>
<body>
<input type="text" id="my_tb" value="testtext"/>
</body>
</html>
[/HTML]
another way would be to do it with javascript ...

kind regards
Dec 22 '07 #7

Markus
Expert 5K+
P: 6,050
how to change the text box colour using html/javascript.
once u move ur mouse pointer on text field or u click on text field , then color of text field shuold change
Using javascript you could do:
Expand|Select|Wrap|Line Numbers
  1. <input type="text" value="CHANGE COLOR" id="foo" name="bar" onfocus="this.style.color='red';"/>
  2.  
merry christmas :)

Edit:
if you wanted the color to revert back to whatever it was before:
Expand|Select|Wrap|Line Numbers
  1.                 <input type="text" 
  2.         value="CHANGE COLOR" 
  3.         id="foo" name="bar" 
  4.         onfocus="this.style.color='red';"
  5.         onblur="this.style.color='';"/>
  6.  
Dec 22 '07 #8

drhowarddrfine
Expert 5K+
P: 7,435
gits example above would only work in a modern browser and not Internet Explorer. I'm off to a job and can't think of a solution for some reason.
Dec 22 '07 #9

gits
Expert Mod 5K+
P: 5,343
gits example above would only work in a modern browser and not Internet Explorer. I'm off to a job and can't think of a solution for some reason.
hi ... sorry ... couldn't test it since i don't have an IE here ... i'm using a mac ;) ... it worked in FF and Safari ... but i as i said ... it is an example. i think IE would have problems with the hover and/or attribute selectors at all ... so we have to use a javascript solution (silly IE again :D )?

kind regards
Dec 22 '07 #10

drhowarddrfine
Expert 5K+
P: 7,435
Yes. Stupid IE is more like it.
Neither focus or hover will work.
It sure seems like I've done a CSS solution before but I'M UNDER A LOT OF PRESSURE TODAY. :)
Dec 22 '07 #11

pbmods
Expert 5K+
P: 5,821
Would this work?

Expand|Select|Wrap|Line Numbers
  1. input[disabled="disabled"]
  2. {
  3.     color: #990000;
  4. }
  5.  
Dec 22 '07 #12

Post your reply

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