What i want , there is text field and when the cursor goes on it , it should call a css class where the back ground color of that text field should get changed to some color defined in the css class. i have a text field on a JSP page i.e.:- <html:text property="product_code" size="30" maxlength="30" onfocus="style.background='#99CCCC'" onblur="style.background='#FFFFFF'" /> If i do(Bolded code on onblur and onfocus) like this as shown above then it works. But i want to call a class. I have saved a css file with color.css and defined a class in it as :- .in { style.background : '#99CCCC' ; } .out { style.background : 'white' ; } I want 'in' class to be called on text field's focus and 'out' class to be called on its onblur. But the problem is that how can i call these classes or where these classes should be called. Also please check the above css class whether iam doing it correctly or not. Please help to resolve my this basic question. Thanks in advance...