<table id="mytable">
<tr>
<td>A</td>
<td>B</td>
<td>C</td>
<td>D</td>
</tr>
</table>
<script>
var colors = ["green","blue","red","yellow","orange"];
var tab = document.getElementById("mytable");
var td = tab.getElementsByTagName("td");
setInterval(function(){
for(var i =0; i < td.length; i++) {
td[i].style.backgroundColor = colors[Math.floor((Math.random()*td.length -1))];
}
},1000)
</script>