To change the css class name of the html element through JavaScript, use the following function
//Change the class of the element
function ChangeClass(t, clas)
{
t.className = clas;
}
Use the above function like this
<div class='oldClass' onclick="ChangeClass(this, 'newClass')">Change my class</div>
On click of the above div the class name will be changed to newClass.