title: how to assign random values from array to table cell on a button click
body: <p>I want to implement the code to create a bingo appliacation where it takes the letters from array on a button click.</p>
  
  <p>How can i assign the array element like array(a,b,c) to those 3X3 table cells randomly on run button click. when i got sequence like abc in a row or diagonal i want increment the count value.</p>
  
  <p>I started but i am unable to implement the code. Can i get any suggestion please.</p>
  
  <p>Here is my code</p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
      &lt;script&gt;
      function run(){ 
      var grid = document.getElementById("grid");
       for (var i = 0, row; row = grid.rows[i]; i++){
          row.cells[0].textContent = rand();    
          row.cells[1].textContent = rand();
          row.cells[2].textContent = rand();
       }
  score()
      }
      function rand(){
  var text = new Array();
  var possible = "MCS*";
      return possible.charAt(Math.floor(Math.random() * possible.length));
  }
  function score(){
  var Row = document.getElementById("grid");
  var Cells = Row.getElementsByTagName("td");
  alert(Cells[0].innerText);
  alert(Cells[1].innerText);
  alert(Cells[2].innerText);
  alert(Cells[3].innerText);
  alert(Cells[5].innerText);
  alert(Cells[6].innerText);
  alert(Cells[7].innerText);
  alert(Cells[8].innerText);
  }
      &lt;/script&gt;
      &lt;/head&gt;
      &lt;body&gt;
      &lt;form metdod="post"&gt;
  
      &lt;table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100"v id="grid"&gt;
      &lt;tr&gt;
        &lt;td id="1-1" height="19" width="20%"&gt;&amp;nbsp;&lt;/td&gt;
        &lt;td id="1-2" height="19" width="20%"&gt;&amp;nbsp;&lt;/td&gt;
        &lt;td id="1-3" height="19" width="20%"&gt;&amp;nbsp;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td id="2-1" height="16" width="20%"&gt;&amp;nbsp;&lt;/td&gt;
        &lt;td id="2-2" height="16" width="20%"&gt;&amp;nbsp;&lt;/td&gt;
        &lt;td id="2-3" height="16" width="20%"&gt;&amp;nbsp;&lt;/td&gt;
  
        &lt;/tr&gt;
        &lt;tr&gt;
        &lt;td id="3-1" height="19" width="20%"&gt;&amp;nbsp;&lt;/td&gt;
        &lt;td id="3-2" height="19" width="20%"&gt;&amp;nbsp;&lt;/td&gt;
        &lt;td id="3-3" height="19" width="20%"&gt;&amp;nbsp;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;/table&gt;
  
        &lt;br&gt;&lt;br&gt;
  
        &lt;input type="button" onClick="return run();" value="run"&gt;
        &lt;/form&gt;
        &lt;/body&gt;
        &lt;/html&gt;
  </code></pre>
  
  <p>Thanks in advance..</p>