I am having issue with a piece of javascript code across different internet explorer versions.

The functionality is to add rows to a table on click of a button using javascript.

This works fine in IE8 but fails in IE7,9 and IE10.

The issue is with cells[0]-says cells.0 is null or not an object.
Below is the piece of javascript code.

var datatableObject=document.getElementById("view<portlet:namespace/>:form1:tblquickadd");
var rowObj = datatableObject.tBodies[0].firstChild.cloneNode(true);

Please let me know if anybody has clue on this and what can work across browsers.