<style type="text/css">
table .c { color: red }
.a.c { color: green }
</style>
<body onmousedown="test1()">
<table id="t">
<tr>
<td class="c">Текст</td>
</tr>
</table>
<script type="text/javascript">
function test1(){
document.getElementById('t').getElementsByTagName('td')[0].setAttribute('class', 'a c');
}
</script>