The moose likes HTML, CSS and JavaScript and the fly likes background color in a form field Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "background color in a form field" Watch "background color in a form field" New topic

background color in a form field

Soft Music

Joined: Jan 17, 2002
Posts: 5
I have a form with many text input fields and the fields are located in a table. Initially the text input fields have some kind of background color.
I use an external .js file to do edit check on the fields passing the form as parameter. If any fields are wrong, the .js file will change its background color to red and display an error msg for user to correct the error. Then the user will try to submit the form again and the .js file will again do the edit check. If the newly corrected field has no error, I want to change its background color to its initial background color. How do I remember that initial background color in javascript? Becaus now the input background color is red at this point.
Any help will be appreciated,
Soft Music
Randall Twede
Ranch Hand

Joined: Oct 21, 2000
Posts: 4351

Soft Music,
sorry but i dont know js very well.
I hate to say this but, your name does not comply with the Javaranch naming guidelines which can be found at
please register again with a valid name.
your name should at least look like a real name

Visit my download page
I agree. Here's the link:
subject: background color in a form field
It's not a secret anymore!