W JS jestem na poziomie zlobka wiec moje pytanie moze sie niektorym wydac smieszne :/
Tworze dynamicznie tabele: 1 wiersz to 6 kolumn z opisem, 2 wiersz to samo z checkbox-ami, a ponizej wiersz z div w ktorym potrzebuje umiescic input
Mam taki kod:
function dodajtab(id) { var element = document.getElementById("typ_" + id); var tbl = document.createElement("table"); var tblBody = document.createElement("tbody"); var row = document.createElement("tr"); for (var i = 0; i < 6; i++) { var cell = document.createElement("td"); var cellText = document.createTextNode(naglowek[i]); cell.appendChild(cellText); row.appendChild(cell); } tblBody.appendChild(row); var row = document.createElement("tr"); for (var i = 0; i < 6; i++) { cell = document.createElement("td"); cell.setAttribute("style", "text-align: center;"); el = document.createElement("input"); el.type = "checkbox"; el.value = "checkbox" el.name = "wyjazd[" + id + "][" + input[i] + "]"; if(input[i] == "inny") el.setAttribute("onChange", "inny(this); return false;"); cell.appendChild(el); row.appendChild(cell); } tblBody.appendChild(row); var row = document.createElement("tr"); cell = document.createElement("td"); cell.setAttribute("colspan", "6"); cell.setAttribute("style", "text-align: center;"); el = document.createElement("div"); el.setAttribute("id","wyjazd[" + id + "][inny_block]"); el.setAttribute("style","display: none;"); cell.appendChild(el); row.appendChild(cell); tblBody.appendChild(row); tbl.appendChild(tblBody); element.appendChild(tbl); }
Problem jest taki ze nie moge sobie poradzic z dynamicznym wstawieniem tego ostatniego input do div wyjazd[" + id + "][inny_block] :/
Bede wdzieczny za pomoc.
--
pozdrawiam
Marek