/****动态的增加行****/
function nextRow(){
var productIndexObj = document.getElementById('productIndex');
var productTbl = document.getElementById('productTbl');
var productIndex = parseInt(productIndexObj.value) + 1;
productIndexObj.value = productIndex;
newRow = productTbl.insertRow(-1);
indexCell = newRow.insertCell(0);
indexCell.className = "TableTd";
indexCell.innerHTML = "第"+productIndex+"级:";
noCell = newRow.insertCell(1);
noCell.className = "TableTd";
noCell.innerHTML = "<input name='tableLevel' type='text' class='inputtxt' autocomplete='off' id='productNo_"+productIndex+"' onChange='autoproduct("+productIndex+")' />";
costCell = newRow.insertCell
js动态表格及获取每一个文本框的动态id属性
最新推荐文章于 2023-11-14 13:32:19 发布
这篇博客介绍了如何使用JavaScript动态创建表格行,并在表格中添加输入框,同时展示了如何为每个输入框设置独特的ID属性。此外,还讲解了如何监听输入框的点击事件并根据ID执行相应操作,如删除行、获取ID等。
摘要由CSDN通过智能技术生成