title: Select a row (highlight) from html table and send values onclick of a button
body: <p>Highlight is not function in the web browser. What is the problem of this codes ? Basically, I want to do something highlighted the table row and then post the value of table row to another php page.</p>
  
  <p>test.html</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;link href="test.css" rel="stylesheet" type="text/css" /&gt;
  &lt;script src="test.js" type="text/javascript"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;table id="table"&gt;
      &lt;tr&gt;
          &lt;td&gt;1 Ferrari F138&lt;/td&gt;
          &lt;td&gt;1 000€&lt;/td&gt;
          &lt;td&gt;1 200€&lt;/td&gt;
          &lt;td&gt;Model monopostu stajne Scuderia Ferrari pre sezónu 2013&lt;/td&gt;
          &lt;td&gt;1&lt;/td&gt;
          &lt;td&gt;F138&lt;/td&gt;
          &lt;td&gt;Klik pre detaily&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;2 Ferrari F138&lt;/td&gt;
          &lt;td&gt;1 000€&lt;/td&gt;
          &lt;td&gt;1 200€&lt;/td&gt;
          &lt;td&gt;Model monopostu stajne Scuderia Ferrari pre sezónu 2013&lt;/td&gt;
          &lt;td&gt;1&lt;/td&gt;
          &lt;td&gt;F138&lt;/td&gt;
          &lt;td&gt;Klik pre detaily&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;3 Ferrari F138&lt;/td&gt;
          &lt;td&gt;1 000€&lt;/td&gt;
          &lt;td&gt;1 200€&lt;/td&gt;
          &lt;td&gt;Model monopostu stajne Scuderia Ferrari pre sezónu 2013&lt;/td&gt;
          &lt;td&gt;1&lt;/td&gt;
          &lt;td&gt;F138&lt;/td&gt;
          &lt;td&gt;Klik pre detaily&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/table&gt;
  
      &lt;input type="button" id="tst" value="OK" onclick="fnselect()" /&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>test.js</p>
  
  <pre><code>function highlight(e) {
      if (selected[0]) selected[0].className = '';
      e.target.parentNode.className = 'selected';
  
  }
  
  var table = document.getElementById('table'),
      selected = table.getElementsByClassName('selected');
  table.onclick = highlight;
  
  function fnselect(){
  var $row=$(this).parent().find('td');
      var clickeedID=$row.eq(0).text();
     // alert(clickeedID);
  }
  
  $("#tst").click(function(){
      var value =$(".selected td:first").html();
      value = value || "No row Selected";
      alert(value);
  });
  </code></pre>
  
  <p>test. css</p>
  
  <pre><code>td {border: 1px #DDD solid; padding: 5px; cursor: pointer;}
  
  .selected {
      background-color: brown;
      color: #FFF;
  }
  </code></pre>