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,只是希望大家能搜索到 :)
  • 相关阅读:
    Delphi 学习笔记
    Extjs 4
    面向对象(OOP)
    Java基础
    Ubantu(乌班图)
    CentOS 6.3操作常识
    英语音标单元音篇
    英语音标双元音篇
    英语音标辅音篇
    Oracle补习班第一天
  • 原文地址:https://www.cnblogs.com/Kennytian/p/1034797.html
Copyright © 2011-2022 走看看