Calling javascript function within innerHTML
<p>I created an addRow function which allows me to add row to a table. After i Add the row, I wanted to create an option to delete the new row. Is there a way to recycle my function?</p>

<pre><code>function addRow() {
 var table = document.getElementById('dataTable');
 var rowCount = table.rows.length;
 var newRow= table.insertRow((1));
 var c0 = newRow.insertCell
 c0.innerHTML="&lt;div &gt;&lt;img src='include/images/cross.png' alt='delete row' onclick='deleteRow(rowCount)'/&gt;&lt;/div&gt;";
  }

function deleteRow(row){
 var elem = document.getElementById('tr'+row);
 var old = (elem.parentNode).removeChild(elem);
 }
</code></pre>
