javascript change color of a dynamically added row
<p>I been doing a small script in HTA in which it reads info from text files and show the info on screen.
I have a table with a header row.</p>

<pre><code>&lt;table cellspacing="2" cellpadding="2" border="1" id="TablaResultados" style="font-size:10;"&gt;
  &lt;tr bgcolor="#cd0041" align="center" style="color:white;"&gt;
    &lt;th&gt;Fecha&lt;/th&gt;
    &lt;th&gt;Id Evento&lt;/th&gt;
    &lt;th&gt;Tipo Evento&lt;/th&gt;
    &lt;th&gt;Ubicacion&lt;/th&gt;
    &lt;th&gt;Nombre&lt;/th&gt;
    &lt;th&gt;Apellido&lt;/th&gt;
    &lt;th&gt;Comentarios&lt;/th&gt;    
  &lt;/tr&gt;
&lt;/table&gt;
</code></pre>

<p>and in this table I add dynamically rows of the info I read using javascript</p>

<pre><code>function AgregarFila(Datos) {
  var table = document.getElementById("TablaResultados");
  var ArrDatos = Datos.split("@");
  var row = table.insertRow(1);
  var LargoArreglo = ArrDatos.length;

  for (var i = 0; i &lt; LargoArreglo; i++){
    var cell1 = row.insertCell(i);
    cell1.innerHTML = ArrDatos[i];
    cell1.style.backgroundColor = "#99cc00"; 
  }
}
</code></pre>

<p>every N rows I need to clear the color of the rows to white, and I am using this</p>

<pre><code>function TablaABlanco() {
  var table = document.getElementById("TablaResultados");
  var rows = table.getElementsByTagName("tr");

  for (var i = 1; i &lt; rows.length; i++) {
    rows[i].style.backgroundColor = "#ffffff";
  }
}
</code></pre>

<p>My issue is that it does not change the color of the rows. I know that the function <code>TablaABlanco</code> does work because if I run the <code>for loop</code> from zero it changes the color of the header of the previous table.</p>

<p>I believe I might need to check something else to validate the new rows but I have been googling with no luck.</p>