Search Tools Links Login

CSS/VBScript change background-color of txt-fields after type in

A real good way to show wich txtfields are required in a form!
If you type in some stuff in the txtfield, the color change.
In the example the color change from red to green.

Original Author: Mathias Stocker


Works only in IE but you dont get a Failure msg or something like that in NS
Create a Textfield like

Be sure that you've the name of the textfield in onchange="OC(T1)" (Here T1)
Put the following Script in the Body-Section of your Page
PS: You can use every css attribute if you like to change not only the colors!
If you dont know the Scripting Version for the css attributes (for example html: style="BACKGROUND-COLOR:#FFFFFF" scripting: style.backgroundcolor="#FFFFFF") you will find it under
If you like this easy small script then please vote for me!


About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 265 times




No attachments for this post

Loading Comments ...


No comments have been added for this post.

You must be logged in to make a comment.