title: HTML+JavaScript: How to highlight a row on click of a button in Javascript?
body: <p>I am using below code to generate a dynamic table-</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;script&gt;
          document.write("&lt;table id=appTable border=1 style=margin-top:10px; margin-left:10px;&gt;");
          document.write("&lt;tr&gt;&lt;th&gt;Select&lt;/th&gt;&lt;th&gt;Name&lt;/th&gt;&lt;th&gt;Location&lt;/th&gt;&lt;th&gt;Action&lt;/th&gt;&lt;/tr&gt;");
          for (row = 1; row &lt; 5; row++) {
  
              document.write("&lt;tr&gt;");
  
              for (col = 1; col &lt;= 4; col++) {
                  if(col == 1) {
                      document.write("&lt;td&gt;&lt;input type='checkbox' id='mapCheck' name='myTextEditBox' /&gt;&lt;/td&gt;");
                  }
                  if(col == 2) {
                      document.write("&lt;td width='140'&gt;Name&lt;/td&gt;");
                  }
                  if(col == 3) {
                      document.write("&lt;td width='200'&gt;Location&lt;/td&gt;");
                  }
                  if(col == 4) {
                      document.write("&lt;td&gt;&lt;button type='button'&gt;select&lt;/button&gt;&lt;/td&gt;");
                  }
              }
  
              document.write("&lt;/tr&gt;")
  
          }
  
          document.write("&lt;/table&gt;")
      &lt;/script&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>When the select button is clicked the table row should highlight the entire row.
  Any idea how to implement it in <code>javascript</code> &amp; <code>css</code> ?</p>