How to change an element's class with JavaScript?

How can I change a class of an HTML element in response to an onclick event using JavaScript?