Div colour on textbox change

I have a series of divs each of which contain an image, a line of text and a textbox where the user enters a number.

Is there a way to make the background of the div change colour if the number in the text box isn’t 0.

Or could this be done using a:visited?

Any pointers would be really appreciated.

You could add an onchange event handler to the text box which changes the bg colour of the div if the current value of the text box is not 0.