New to Javascript and I'm trying to accomplish this.. I'm wrapping text input and submit button form elements inside a div. When either the text field or the submit button gain focus, I want to swap the class on the parent div. The form elements themselves wouldn't change, but the wrapper div would, for example, gain and lose a border depending on whether any of its contents had focus.
This'll require javascript. I'm partial to two javascript libraries: event:Selectors and Prototype. With these, it's pretty easy. If you look at the event:Selectors page, you'll see examples, and then I'd use Prototype's addClassName, removeClassName, and hasClassName functions to toggle the classes. To actually find the div the form elements are in, you could either get the parentNode of those elements, or give the div an id.