- 论坛徽章:
- 0
|
代码:
var row = document.createElement("tr");
var nameInput = document.createElement("input");
nameInput.setAttribute("type", "text");
nameInput.setAttribute("value", name);
nameInput.setAttribute("name", "name");
nameInput.setAttribute("id", ID);
nameInput.setAttribute("title", "name");
nameInput.onDblclick = function () { updateEmployee(); };
cell = document.createElement("td");
cell.appendChild(nameInput);
row.appendChild(cell);
var DirectorInput = document.createElement("input");
DirectorInput.setAttribute("type", "text");
DirectorInput.setAttribute("value", Director);
DirectorInput.setAttribute("id", ID);
DirectorInput.setAttribute("name", "Director");
DirectorInput.setAttribute("title", "Director");
DirectorInput.onDblclick = function () { updateEmployee(); };
cell = document.createElement("td");
cell.appendChild(DirectorInput);
row.appendChild(cell);
var TechnologyInput = document.createElement("input");
TechnologyInput.setAttribute("type", "text");
TechnologyInput.setAttribute("value", Technology);
TechnologyInput.setAttribute("id", ID);
TechnologyInput.setAttribute("name", "Technology");
TechnologyInput.setAttribute("title", "Technology");
TechnologyInput.onclick = function () { updateEmployee(); };
cell = document.createElement("td");
cell.appendChild(TechnologyInput);
row.appendChild(cell);
document.getElementById("employeeList").appendChild(row);
}
<tbody id="employeeList"></tbody>
这样一个自动生成的表格,我想取第一个单元格里input的一些属性性,如id,name,value,怎么取.
var employeeList = document.getElementById("employeeList");
var employeeListName = employeeList.getElementsByTagName("name")[0].firstChild.nodeValue
为什么取不得,请问怎么取? |
|