title: table row incertCell : Index or size was negative, or greater than the allowed value
body: <p>when I try to dynamically insert cells to a table with an unknown size (in cells) I got an "Index or size was negative, or greater than the allowed value." error : </p>
  
  <pre><code>    function addTableRow(id, at)
      {
          at = typeof at !== 'undefined' ? at : 0; 
          var table=document.getElementById(id);
          var row=table.insertRow(at); 
              var cells = table.rows[0].cells.length;
              for(var i = 0; i &lt; cells; ++i)
              {
                    row.insertCell(i);
                    row.className="success";
                row.innerHTML = "OMG";
              }
      }
  </code></pre>
  
  <p>and if I put an alert in the 'for' the error happens in the second row, I think I miss something somewhere, any idea ? </p>