zoukankan      html  css  js  c++  java
  • 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);
        }

  • 相关阅读:
    Zero Copy
    内核态(Kernel Mode)与用户态(User Mode)
    Netty端口被占用问题
    AsyncHttpClient的连接池使用逻辑
    HashMap 与 ConcurrentHashMap
    Java NIO Test Case
    Netty writeAndFlush() 流程与异步
    Java 文件路径相关
    代理的匿名程度
    Netty堆外内存泄露排查与总结
  • 原文地址:https://www.cnblogs.com/zengxlf/p/1451100.html
Copyright © 2011-2022 走看看