怎么实现我单击新增 下来的作业时间、作业地点这个table会在下面依次增加 这个页面是2个table 上面申请人单独一个  求大神给个代码啊 !!!

解决方案 »

  1.   

    楼主表达能力要增强啊 看了老半天  你的意思是点击按钮就把第二行下面再添加一行 内容和第一行一样吧  那样你只需要吧这个表格添加一行就可以了嘛function addTableRow() {
     var table1 = document.getElementByIdx_x('table1');
     var cloneTab = document.getElementByIdx_x('table2');
     //alert(cloneTab.firstChild.firstChild.innerHTML);
        //alert(cloneTab.firstChild.firstChild.cloneNode(true).innerHTML);
     table1.firstChild.appendChild(cloneTab.firstChild.firstChild.cloneNode(true));
     var v= table1.firstChild.childNodes;
     var len = v.length;
     for(var i=1;i<len;i++){
      v[i].childNodes[0].firstChild.id=i;//给第一个单元格id赋值
     }
    }
      

  2.   

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>    <script>    
    function addrow()    
    {      
    $("#test").html( $("#test").html()+"<tr><td>1</td><td>2</td><td>3</td></tr>")    }    
    </script>   
    <table id="test">   
    <tr>
    <td colspan="3">
    <input id="Button1" type="button" value="button" onclick="addrow()" />       
    </td>
    </tr>   
    </table>
      

  3.   

    <div style="display:none;"><table id="table2"></table></div>
    tb = document.getElementById('table2');
                newRow = tb.insertRow();
                newRow.insertCell().innerHTML = "<input type=XX >";
                //////
            }
      

  4.   


    $("#buttonid").click(function(){
       $("#htmlid").append("<table><tr><td></td><tr></table>");
    });