• JS表的行添加操作(insertRow)


    var rowCount = document.getElementById("dataTable").rows.length;
     

       var createCount;
        var tbObj = document.getElementById("dataTable");
        if(rowCount == 0){
         var rs = tbObj.rows;
         var count = rs.length;
         document.mainFrm.rowNewCount.value = 0;
         document.mainFrm.rowCount.value = 0;
         var newTr = tbObj.insertRow();
                   
         newTr.height="22";
         //newTr.style="cursor:'hand'";
         newTr.onMouseMove="style.backgroundColor='#EFEFEF'";
         newTr.onMouseOut="style.backgroundColor='#ffffff'";
        
         var newTd0 = newTr.insertCell();
         newTd0.width="3%";
         newTd0.align="center";
        
         var newTd1 = newTr.insertCell();
         newTd1.width="40%";
         newTd1.align="left";
        
         var newTd2 = newTr.insertCell();
         newTd2.width="40%";
         newTd2.align="left";
        
         newTd0.innerHTML = "<input type='checkbox' name='relationId' id='relationId' value=''>";
         newTd1.innerHTML = "<input type='text' name='orgCode' value='' class='noemptyInput' style=' 100%' onblur='ajaxValidateCode(this)'>";
         newTd2.innerHTML = "<input type='text' name='orgName' value='' class='noemptyInput' style=' 100%'>";
         createCount = count;
         createCount ++;
         document.mainFrm.createCount.value = createCount;
        } else {
         var rs = tbObj.rows;
         var count = rs.length;
         var row0 = rs[count - 1];
         var newRow = row0.cloneNode(true);
         newRow.firstChild.nextSibling.firstChild.value = "";
         newRow.lastChild.firstChild.value = "";
         if(document.mainFrm.rowCount.value == ""){
          document.mainFrm.rowCount.value = count;
         }
         createCount = count;
         createCount ++;
         document.mainFrm.createCount.value = createCount;
         row0.appendChild(newRow);
        }

  • 相关阅读:
    Lab IGMP
    IGMP知识要点
    15、通过例子讲解逻辑地址转换为物理地址的基本过程
    14、一个程序从开始运行到结束的完整过程,你能说出来多少?
    13、进程状态的切换你知道多少?
    12、虚拟技术你了解吗?
    11、动态分区分配算法有哪几种?可以分别说说吗?
    线程池
    10、内存交换和覆盖有什么区别?
    9、如果系统中具有快表后,那么地址的转换过程变成什么样了?
  • 原文地址:https://www.cnblogs.com/zengxlf/p/1451100.html
Copyright © 2020-2023  润新知