It is strange that you place an element Ainside an element A, but the following should work.
var c=document.createElement('a');
c.name = "a1";
c.className = "b";
c.href = d[2].value;
c.appendChild(document.createTextNode(d[1].value));
This suggests that d[1].value, as you know, HTML is not well-formed from a trusted source, so it is more likely to be more XSS resistant than code innerHTML.
source
share