我想在点击表格内的值时添加值:
这是我的代码:
function addRowHandlers() {
var rows = document.getElementById("tableId").rows;
for (i = 0; i < rows.length; i++) {
rows[i].onclick = function () {
return function () {
var cell = this.cells[0];
var id = cell.innerHTML;
var text_to_be_inserted = id;
alert(text_to_be_inserted);
document.getElementById("TextArea").value = text_to_be_inserted;
};
} (rows[i]);
}
}