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:
function ChangeNames(newFields)
{
var newField = newFields.childNodes;
for (var i=0;i<newField.length;i++)
{
ChangeNames(newField[i]);
if (newField[i].name)
{
newField[i].name = newField[i].name + counter;
}
}
}
function moreFields()
{
counterter++;
var newFields = document.getElementById('readroot').cloneNode(true );
var insertHere = document.getElementById('writeroot');
ChangeNames(newFields);
insertHere.parentNode.insertBefore(newFields,inser tHere);
}
Oscar E.L.