title: How do I populate a table in Javascript by clicking a button using the onClick() function?
body: <p>Using JavaScript, I want to populate the numbers in soduku.setstring(); into a table once a user clicks the button "Easy". How can I achieve this using the onClick() function? </p>
  
  <pre><code>function initialize() {
  var col, row;
  for (row = 0; row &lt;=8; row++) {
  for (col=0; col &lt;= 8; col++) {
  var cell = document.getElementById('cell_' + col + '_' + row);
  if (!parseInt(cell.innerHTML)) {
  // cell is empty
  cell.onclick = selectCell;
  cell.className = 'tofill';
  }
  }
  }
  document.onkeypress = keyPress;
  }
  
  function easygame(){
  
      var sudoku.setString("240057360000008009378000200060041702080000005000005010130000000050003026000812000");
      loadPuzzle(sudoku);
      updateUI();
  }
  
  function updateUI(){
      initialize();
  
  }
  
  
  &lt;input type="button" value="Easy" onclick="easygame()"/&gt;
  &lt;table align=center id="sudoku" cellspacing=0&gt;
  &lt;tr&gt;
  &lt;td id="cell_0_0"&gt;&lt;/td&gt;
  &lt;td id="cell_1_0"&gt;&lt;/td&gt;
  &lt;td id="cell_2_0"&gt;&lt;/td&gt;
  &lt;td id="cell_3_0"&gt;&lt;/td&gt;
  &lt;td id="cell_4_0"&gt;&lt;/td&gt;
  &lt;td id="cell_5_0"&gt;&lt;/td&gt;
  &lt;td id="cell_6_0"&gt;&lt;/td&gt;
  &lt;td id="cell_7_0"&gt;&lt;/td&gt;
  &lt;td id="cell_8_0"&gt;&lt;/td&gt;
  &lt;tr&gt;
  </code></pre>