title: how to add checkboxes in cells of first column of HTML table?
body: <p>I am working on an app development which will read through my mailbox and list all the unread e-mails in a HTML table on my web-app upon click of a button. Below is the code which I have made while researching through google which solves for the purpose.</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;body&gt;
  
  &lt;button onclick="groupFunction()"&gt;Click me&lt;/button&gt;
  
  &lt;table id="tblContents"&gt;
     &lt;tr onclick="tableClickTest()"&gt;
      &lt;th&gt;Sender&lt;/th&gt;
      &lt;th&gt;Sent_Date&lt;/th&gt; 
      &lt;th&gt;Received_By&lt;/th&gt;
  
  &lt;th&gt;Received_Date&lt;/th&gt;
  &lt;th&gt;Subject&lt;/th&gt;
  &lt;/tr&gt;
  
  &lt;/table&gt; 
  
  
  &lt;script&gt;
  
  function RowSelection()
  {
  var table = document.getElementById("tblContents");
  if (table != null) {
      for (var i = 0; i &lt; table.rows.length; i++) {
          for (var j = 0; j &lt; table.rows[i].cells.length; j++)
          table.rows[i].cells[j].onclick = function () {
              tableText(this);
          };
      }
  }
  }
  
  
  function tableText(tableCell) {
      alert(tableCell.innerHTML);
  }
  
  
  
  function PopulateTable()
              {
  
                  var objOutlook = new ActiveXObject("Outlook.Application");
                  var session = objOutlook.Session;
  //alert(session.Folders.Count)                
                  for(var folderCount = 1;folderCount &lt;= session.Folders.Count; folderCount++)
                  {
                      var folder = session.Folders.Item(folderCount);
  //alert(folder.Name)                
                      if(folder.Name.indexOf("Premanshu.Basak@genpact.com")&gt;=0)
                      {
                          for(var subFolCount = 1; subFolCount &lt;= folder.Folders.Count; subFolCount++)
                          {
                              var sampleFolder = folder.Folders.Item(subFolCount);
  //alert(sampleFolder.Name)
                              if(sampleFolder.Name.indexOf("test1")&gt;=0)
                              {
                                  for(var itmCount = 1; itmCount &lt;= sampleFolder.Items.Count; itmCount++)
                                  {                                    
                                      var itm = sampleFolder.Items.Item(itmCount);
                                      if(!itm.UnRead)
                                          continue;
                                      var sentBy = itm.SenderName;
                                      var sentDate = itm.SentOn;
                                      var receivedBy = itm.ReceivedByName;
                                      var receivedDate = itm.ReceivedTime;
                                      var subject = itm.ConversationTopic;
  //                                    var contents = itm.Body;
  
                                      var tbl = document.getElementById("tblContents");
                                      if(tbl)
                                      {
                                       var tr = tbl.insertRow(tbl.rows.length);
  //                  tr.onclick(tableClickTest())                                  
  
                                       if(tbl.rows.length%2 != 0)
                                       tr.className = "alt";
  
                                       var tdsentBy = tr.insertCell(0);
                                       var tdsentDate = tr.insertCell(1);
                                       var tdreceivedBy = tr.insertCell(2);
                                       var tdreceivedDate = tr.insertCell(3);
                                       var tdsubject = tr.insertCell(4);
  //                                     var tdcontents = tr.insertCell(5);        
  
                                       tdsentBy.innerHTML = sentBy;    
                                       tdsentDate.innerHTML = sentDate;
                                       tdreceivedBy.innerHTML = receivedBy;
                                       tdreceivedDate.innerHTML =    receivedDate;
                                       tdsubject.innerHTML = subject;
  //                                     tdcontents.innerHTML = contents;
                                       }
                                     //itm.UnRead = false;    
                                   }
                                  break;    
                              }
                          }
                          break;
                        }
                      }
                  return;
              }    
  
  function groupFunction()
  {
  PopulateTable()
  RowSelection()
  }
  
  
  &lt;/script&gt;
  
  &lt;/body&gt;
  &lt;/html&gt; 
  </code></pre>
  
  <p>The thing that I am now looking for and is unable to do is how do I add a checkbox in the first column in each row. Also upon checking this checkbox the entire row should get highlighted so that I can perform specific task on all the selected items.</p>