function addRow(id) { //get control of the table. var tbody = document.getElementById(id).getElementsByTagName("TBODY")[0]; //create the input objects var input1 = document.createElement("input"); input1.type="text"; input1.size="45" input1.name="text1"; input1.id="name1"; var input2 = document.createElement("input"); input2.type="text"; input2.size="25" input2.name="text1"; input2.id="name1"; var input3 = document.createElement("input"); input3.type="text"; input3.size="45" input3.name="text1"; input3.id="name1"; //create the row object var row = document.createElement("TR"); //create the cells var td1 = document.createElement("TD"); var td2 = document.createElement("TD"); var td3 = document.createElement("TD"); //attach the row the the table tbody.appendChild(row); //add the cells to the row row.appendChild(td1); row.appendChild(td2); row.appendChild(td3); //add the inputs to the cells td1.appendChild(input1); td2.appendChild(input2); td3.appendChild(input3); }