I have an output.php. It creates an html table with 3 columns: Question number, Correct Answer, Student Answer. Works just as I want it to.

Now what I would like is to paint the cells with incorrect student answers red. I think Javascript is the best way to do this, rather than php.

Looking at other answers here, I was hoping this might do the job, but, alas ...

Can you please help me get this working?

```
<script type="text/javascript" >
function paint_cells() {
    var tds = document.querySelectorAll('tbody td'), i;
    for(i = 0; i < tds.length; i += 3) {
      if(tds[i+1].textContent != tds[i+2].textContent){
        tds[i+2].bgColor = "red";
      }
    }
</script>

```