by Alan » Mon Jan 03, 2011 5:32 am
First things first, you mean JavaScript (a dynamically typed scripting language available in most browsers and some server-side implementations) not Java (a statically typed programming language that compiles to bytecode which can be executed on the Java VM and only be used in a browser with the relevant plugin). Apart from the name, the two have more differences than similarities.
If you want a button to change another element's styling, I don't really see another way to do it other than using JavaScript. It's really simply to do in JavaScript, too. You shouldn't need more than a single line of code (maybe three, if you want some readability).