Javascript 如何在可滚动表中保留动态添加的行
Javascript 如何在可滚动表中保留动态添加的行,javascript,css,Javascript,Css,函数addField(参数){ var myTable=document.getElementById(“myTable”); var currentIndex=myTable.rows.length; var currentRow=myTable.insertRow(-1); var linksBox=document.createElement(“文本”); setAttribute(“名称”、“链接”+currentIndex); var关键字box=document.createElem
函数addField(参数){
var myTable=document.getElementById(“myTable”);
var currentIndex=myTable.rows.length;
var currentRow=myTable.insertRow(-1);
var linksBox=document.createElement(“文本”);
setAttribute(“名称”、“链接”+currentIndex);
var关键字box=document.createElement(“输入”);
关键字box.setAttribute(“名称”、“关键字”+currentIndex);
var violationsBox=document.createElement(“输入”);
setAttribute(“名称”、“violationtype”+currentIndex);
var currentCell=currentRow.insertCell(-1);
currentCell.appendChild(linksBox);
currentCell=currentRow.insertCell(-1);
currentCell.appendChild(关键字框);
currentCell=currentRow.insertCell(-1);
currentCell.appendChild(violationsBox);
}
升级
您需要在表格上添加一个显示:块
,使其可滚动:
函数addField(参数){
var myTable=document.getElementById(“myTable”);
var currentIndex=myTable.rows.length;
var currentRow=myTable.insertRow(-1);
var linksBox=document.createElement(“文本”);
setAttribute(“名称”、“链接”+currentIndex);
var关键字box=document.createElement(“输入”);
关键字box.setAttribute(“名称”、“关键字”+currentIndex);
var violationsBox=document.createElement(“输入”);
setAttribute(“名称”、“violationtype”+currentIndex);
var currentCell=currentRow.insertCell(-1);
currentCell.appendChild(linksBox);
currentCell=currentRow.insertCell(-1);
currentCell.appendChild(关键字框);
currentCell=currentRow.insertCell(-1);
currentCell.appendChild(violationsBox);
}
升级
你累了吗最大高度:50px?