title: Javascript only goes through the first iteration of a for statement
body: <p>I've been trying to figure out why this 'for' only loops once. Having spent about 6 hours re-writing conditions, I was wondering if you could give me a hand with spotting the problem. </p>
  
  <p>Thanks in advance for any piece of advise and your time !</p>
  
  <pre><code>var k;
  var i = 1;
  
  function stergeLinie(k) {
      var tabel = document.getElementById('produse');
      var rowCount = tabel.rows.length;
  
      var row = document.getElementById("tr" + k);
      row.parentNode.removeChild(row);
  
      var t = rowCount;
      for (y = k; y &lt; t; y++) {
          document.getElementById("nrcrtid" + (y + 1)).value = y;
          document.getElementById("nrcrtid" + (y + 1)).name = "nr_crt" + y;
          document.getElementById("nrcrtid" + (y + 1)).id = "nrcrtid" + y;
          document.getElementById("prodid" + (y + 1)).name = "prod" + y;
          document.getElementById("prodid" + (y + 1)).id = "prodid" + y;
          document.getElementById("umid" + (y + 1)).name = "um" + y;
          document.getElementById("umid" + (y + 1)).id = "umid" + y;
          document.getElementById("cantitateid" + (y + 1)).name = "cantitate" + y;
          document.getElementById("cantitateid" + (y + 1)).id = "cantitateid" + y;
          document.getElementById("pretid" + (y + 1)).name = "pret" + y;
          document.getElementById("pretid" + (y + 1)).id = "pretid" + y;
          document.getElementById("pretfaraTVAid" + (y + 1)).name = "pretfaraTVA" + y;
          document.getElementById("pretfaraTVAid" + (y + 1)).id = "pretfaraTVAid" + y;
          document.getElementById("tvaid" + (y + 1)).name = "tva" + y;
          document.getElementById("tvaid" + (y + 1)).id = "tvaid" + y;
          document.getElementById("tr" + (y + 1)).id = "tr" + y;
          document.getElementById("buton" + (y + 1)).id = "buton" + y;
          document.getElementById("butons" + (y + 1)).onclick = function onclick(event) {
              stergeLinie(y);
          }
          document.getElementById("butons" + y).id = "butons" + (y);
      }
      alert(y);
  
      document.getElementById("tr" + i).style.height = "100%";
      i--;
  }    
  </code></pre>