467,161 Members | 1,092 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

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

how to change the color of the text

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
  • viewed: 7981
Share:
11 Replies
drhowarddrfine
Expert 4TB
In what way are you doing this? Show the code.
Apr 4 '07 #2
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 2GB
maybe "readonly" will be more appropriate than "disabled".
Apr 4 '07 #4
Expert 1GB
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
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 4TB
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 4TB
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 4TB
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 4TB
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 4TB
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 4TB
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.

Similar topics

14 posts views Thread by Reply Via Newsgroup | last post: by
4 posts views Thread by ACaunter | last post: by
3 posts views Thread by John Smith | last post: by
2 posts views Thread by John Smith | last post: by
7 posts views Thread by =?Utf-8?B?QnJpYW4gQ29vaw==?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.