title: Create link in an html table with javascript
body: <p>I am using the following code to add columns dynamically to a html table:</p>
  
  <pre><code>var tblHeadObj = window.opener.document.getElementById("maintable").tHead;
  var j=0;
  while(j &lt; fname.length)
  { 
    if(tblHeadObj != null) 
    {
      for(var h = 0; h &lt; tblHeadObj.rows.length; h++) 
      {
        var newTH = window.opener.document.createElement('th');
  
        tblHeadObj.rows[h].appendChild(newTH);
        //newTH.innerHTML='[th]row:'+h+'cell:'+(tblHeadObj.rows[h].cells.length-1)
      }
    }
    var tblBodyObj = window.opener.document.getElementById("maintable").tBodies[0];
    //for(var i = 0; i &lt; tblBodyObj.rows.length; i++) {
    var newCell=tblBodyObj.rows[0].insertCell(-1);
    var newCell=tblBodyObj.rows[0].insertCell(-1);
    // newCell.innerHTML = (tblBodyObj.rows[0].cells.length - 1)
    newCell.innerHTML=  fname[j];
    j++;
  }
  </code></pre>
  
  <p>Now i want to make columns as link.How can i do that?</p>
  
  <p>Thanks</p>