This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
You can color the background with the background-color CSS property.
For changing based upon whether the field is empty or not, you will need to establish event handlers on the text field to detect changes. The onchange handler itself will not be enough because it's not called on individual keystrokes. You'll need to also at least listen to onkeyup.
It's not foolproof however. I'm not sure how you can capture the field being emptied by a cut operation via the menu for example.
[ October 03, 2005: Message edited by: Bear Bibeault ] [ October 03, 2005: Message edited by: Bear Bibeault ]