Ktoś mi powie dlaczego ?
Kodzik JS:
var lines = 2; var maks = 26; var mini = 6; function AddLine(table){ if (lines == maks) { alert("Osiągnąłeś maksymalną liczbę dokumentów!\nWygeneruj teraz PDF i przygotuj kolejną checklistę!"); } else { var row = document.createElement('tr'); row.setAttribute("id",'dok_'+lines); var cell = document.createElement('td'); var inpt = document.createElement('input'); var cellText = document.createTextNode(lines); cell.appendChild(cellText); row.appendChild(cell); var cell = document.createElement('td'); var inpt = document.createElement('input'); var cellText = document.createTextNode(lines); inpt.setAttribute("type",'text'); inpt.setAttribute("name","name["+lines+"]"); cell.appendChild(inpt); row.appendChild(cell); var cell = document.createElement('td'); var inpt = document.createElement('input'); var cellText = document.createTextNode(lines); inpt.setAttribute("type",'text'); inpt.setAttribute("name","doc["+lines+"]"); cell.appendChild(inpt); row.appendChild(cell); var cell = document.createElement('td'); var inpt = document.createElement('input'); var cellText = document.createTextNode(lines); inpt.setAttribute("type",'text'); inpt.setAttribute("name","uwagi["+lines+"]"); cell.appendChild(inpt); row.appendChild(cell); document.getElementById(table).appendChild(row); lines++; } } function DelLine(table) { var lp = lines-1; var tabelka = document.getElementById(table); var row = document.getElementById('dok_'+lp); tabelka.removeChild(row); lines = lp; alert("DEL: dok_"+lp); }
i to co w htmlu: