The problem is that this is what we have ended up with whereas each id needs to be unique.

This is what we really want!
Each cell and score has a unique id.

Let's number the first row 0 and the second row 1.
Let's pass that number to our one_row function and re-visit it.

  <div class='row'>
    <script>one_row(0);</script>
  </div>
  <div class='row'>
    <script>one_row(1);</script>
  </div>
one_row.js as it is now
function one_row() {
  var s1=" <img src='counters/0.png' class='cell' id='";
  var s2="' cn='0' onClick='cell_clicked(this);'>";
  for (var i=0; i<5; i++) {
    document.write(s1 + i + s2);
  }
  document.write("<div id='s0'>0</div>");
}