Entry
(How) can I set the background color of a text field/text area?
Mar 8th, 2000 14:04
Martin Honnen,
Only IE4/5 (and likely NN6) support that using css statically or the
style object dynamically.
CSS:
<INPUT TYPE="text" STYLE="background-color: red;">
JavaScript:
var field = document.formName.fieldName;
if (field.style) // dynamic style scripting possible
field.style.backgroundColor = 'red';
Color values in css can also be specified as triples e.g.
<INPUT STYLE="background-color: rgb(255, 0, 0)">
respectively
field.style.backgroundColor = 'rgb(255, 0, 0)';
Using
#FF0000
might also work.