function addEventPresentRow() {
var row = document.createElement("tr");
var cell = document.createElement("td");
var cell2 = document.createElement("td");
var input = document.createElement("input");
input.setAttribute("type", "text");
input.setAttribute("name", "present");
var button = document.createElement('input');
if(button.getAttribute('onclick')){ //else IE
button.setAttribute('onclick','delRow(this)');
} else{ //IE
button = document.createElement("<input onclick=\"delRow(this) \">");
}
button.setAttribute("type", "button");
button.setAttribute("value", "-");
cell.appendChild(input);
row.appendChild(cell);
cell2.appendChild(button);
row.appendChild(cell2);
document.getElementById("targetBody").appendChild(row);
}
function delEventPresentRow(buttonObj) {
var tableBody = document.getElementById("targetBody");
var index = buttonObj.parentElement.parentElement.rowIndex;
tableBody.removeChild(tableBody.childNodes[index]);
}
댓글 없음:
댓글 쓰기