Thomas Meinike: Folgefrage

Beitrag lesen

Hallo,

innerHTML bringt immer den "Unknown runtime error" (?!?).

Kann ich ohne Code nicht nachvollziehen.

cloneNode() ist nicht so klasse, da ohnehin so ziemlich alles anders ist (anderer Name, andere Größe, andere onBlur-Funktion für jedes INPUT-Feld).

Deine (unbekannten) 37 Zeilen kann ich ohne große Optimierungsversuche auf 25 verringern:

var row,col;
row=document.createElement("tr");
for(i=0;i<5;i++)row.appendChild(document.createElement("td"));
col=row.document.getElementsByTagName("td");
col[0].appendChild(document.createTextNode("1."));
col[1].appendChild(document.createElement("input"));
col[1].firstChild.setAttribute("type","text");
col[1].firstChild.setAttribute("name","menge[1]");
col[1].firstChild.setAttribute("size","3");
col[2].appendChild(document.createElement("input"));
col[2].firstChild.setAttribute("type","text");
col[2].firstChild.setAttribute("name","produkt[1]");
col[2].firstChild.setAttribute("size","20");
col[3].appendChild(document.createElement("input"));
col[3].firstChild.setAttribute("type","text");
col[3].firstChild.setAttribute("name","einzelpreis[1]");
col[3].firstChild.setAttribute("size","5");
col[3].firstChild.setAttribute("onblur",function(){calcRech();displaynext(1);});
col[3].appendChild(document.createTextNode(" "+String.fromCharCode(8364)));
col[4].appendChild(document.createElement("span"));
col[4].firstChild.setAttribute("id","gesamtpreis1");
col[4].firstChild.setAttribute("name","produkt[1]");
col[4].firstChild.appendChild(document.createTextNode("0,00"))
col[4].appendChild(document.createTextNode(" "+String.fromCharCode(8364)));
document.getElementById("rechnungsposten").getElementsByTagName("tbody")[0].appendChild(row);

MfG, Thomas