I had similar issue. There is a solution in http://www.quirksmode.org/dom/domform.html
, but it wouldn't work properly as it doesn't check for child nodes in every parent, i.e.
<p><input type..../></p> is an scenario that it wouldn't work applying the solution indicated in the link.
Finally, I ended with the following code:
var newField = newFields.childNodes;
for (var i=0;i<newField.length;i++)
newField[i].name = newField[i].name + counter;
var newFields = document.getElementById('readroot').cloneNode(true );
var insertHere = document.getElementById('writeroot');