• 添加一行删除一行-js代码


    <!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>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    <script type="text/javascript" src="jquery-1.11.0.js"></script>
    <script type="text/javascript">
        $(document).ready(function(){
            $("#addline").click(function(){
                var $tr=$("<tr></tr>");
                var $td=$("<td></td>");
                for(var i=0;i<4;i++){
                $td.clone().html(i).appendTo($tr);
                }
                $("table tr:last").after($tr);
            })
            $("#removeline").click(function(){
                $("table tr:last").remove();
            })
            $("#elptyAll").click(function(){
                $("table").elpty();
            })
        })
    </script>
    
    </head>
    <body>
    <table border="1" width="500">
        <tr>
            <td>11</td>
            <td>12</td>
            <td>13</td>
            <td>14</td>
        </tr>
        <tr>
            <td>21</td>
            <td>22</td>
            <td>23</td>
            <td>24</td>
        </tr>
        <tr>
            <td>31</td>
            <td>32</td>
            <td>33</td>
            <td>34</td>
        </tr>
        <tr>
            <td>41</td>
            <td>42</td>
            <td>43</td>
            <td>44</td>
        </tr>
        <tr>
            <td>51</td>
            <td>52</td>
            <td>53</td>
            <td>54</td>
        </tr>
    </table>
    <input type="button" value="增加一行" id="addline"/>
    <input type="button" value="删除一行" id="removeline"/>
    <input type="button" value="清空" id="elptyAll" />
    
    </body>
    
    </html>
  • 相关阅读:
    Nuget:aliyun-openapi-sdk
    iptables简述
    openOffice安装
    bash:command not found
    linux nc命令
    linux命令帮助
    linux用户管理
    LDAP 后缀操作
    LDAP缓存命令
    LDAP索引及缓存优化
  • 原文地址:https://www.cnblogs.com/yunmengxiaohe/p/3873678.html
Copyright © 2020-2023  润新知