zoukankan      html  css  js  c++  java
  • [原] Js动态删除行(支持FireFox)

    DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title> new document </title>
    <style type="text/css" media="all">
    dd
    {display:inline;}
    </style>
    <script type="text/javascript">
    function del(rowIndex) {
      
    var div1ChildNodes = document.getElementById("div1").childNodes.length;
      alert(div1ChildNodes);
      
    var dlRowIndex = "dl" + rowIndex;
      
    var oDl = document.getElementById(dlRowIndex);
      oDl.parentNode.removeChild(oDl);
    }
    </script>
    </head>
    <body>
    <div id="div1">
      
    <dl id="dl1"><dd>11</dd><dd>12</dd></dl>
      
    <dl id="dl2"><dd>21</dd><dd>22</dd></dl>
      
    <dl id="dl3"><dd>31</dd><dd>32</dd></dl>
      
    <dl id="dl4"><dd>41</dd><dd>42</dd></dl>
    </div>
    <input id="btn" value="del row" type="button" onclick="del(1)" />
    </body>
    </html>

    用Js删除一行 动态删除一行 删除li 删除dl
    取子节点数 取子节点个数
    写了这么多无聊的Keywords,只是希望大家能搜索到 :)
  • 相关阅读:
    Hamming Distance(随机算法)
    Difference Between Primes
    Pet(dfs)
    29. Divide Two Integers
    28. Implement strStr()
    25. Reverse Nodes in k-Group
    24. Swap Nodes in Pairs
    23. Merge k Sorted Lists
    22. Generate Parentheses
    19. Remove Nth Node From End of List
  • 原文地址:https://www.cnblogs.com/Kennytian/p/1034797.html
Copyright © 2011-2022 走看看