本帖最后由 xyflash2 于 2011-04-12 20:53:55 编辑

解决方案 »

  1.   

    实现的功能是点按键,添加两个框????是的话,那你少写了个结束</table>;;
    <table cellpadding="0" cellspacing="0">
    <tr>
      <td height="50" valign="top" class="left"><input type="button" name="but1" id="but1" value="加" onclick="file();" /></td>
      <td><table cellpadding="0" cellspacing="0">
          <tbody id="o">
          <tr>
          <td valign="top"class="right"><input type="text" name="_" />&nbsp;&nbsp;<input type="text" name="_" /></td>
          </tr>
         </tbody>
       <tbody id="n"></tbody>
    </table>
    </table>
      

  2.   

    ie6可以。ie7\8\9没测试这样试试呢?
    <table cellpadding="0" cellspacing="0" id="o">
    <tbody>
    -------------
    你把嵌套表格的DOM写完整吧。除了1楼说的,<tbody id="n"></tbody>最好放到新的表格里
      

  3.   

    原来是页面中加有!DOCTYPE的原因?<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    页面开头加这个就出错 不加就好了 该怎么办?
      

  4.   

    请问此功能用jquery如何实现 
      

  5.   

    XHTML 1.0 标准比较严格,你的代码中少了几个标签,可能就出错了吧!
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <HTML>
     <HEAD>
      <TITLE> New Document </TITLE>
      <META NAME="Generator" CONTENT="EditPlus">
      <META NAME="Author" CONTENT="">
      <META NAME="Keywords" CONTENT="">
      <META NAME="Description" CONTENT="">
      <script type="text/javascript" src='http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js'></script>
      <script type="text/javascript">
    $(function(){
    $("#but1").click(function(){
    var newn=$("#o>tr:first").clone(true);
    var tags=newn.find(":input");
    tags.each(function(i){
    if($(this).attr("type")){
    $(this).attr("id",'_' +i);
    $(this).attr("name",'_' +i)
    }
    })
    $("#n").append(newn);
    })
    })
      </script>
     </HEAD> <BODY>
    <table cellpadding="0" cellspacing="0">
    <tr>
     <td height="50" valign="top" class="left">
    <input type="button" name="but1" id="but1" value="加" />
     </td>
     <td>
    </tr>
    </table>
    <table cellpadding="0" cellspacing="0">
      <tbody id="o">
      <tr>
    <td valign="top"class="right">
    <input type="text" name="_" />&nbsp;&nbsp;<input type="text" name="_" />
    </td>
      </tr>
      </tbody>
      <tbody id="n">
      </tbody>
    </table>
     </BODY>
    </HTML>
      

  6.   

    那删除该怎么实现? 也用 jquery ....
      

  7.   

    要学会自己写代码,不要去copy别人的!问思路就行!
      

  8.   


    <input type="button" name="but2" id="but2" value="删除" /> <script type="text/javascript">
        $(function(){
            $("#but1").click(function(){
                var newn=$("#o>tr:first").clone(true);
                var tags=newn.find(":input");
                tags.each(function(i){
                    if($(this).attr("type")){
                        $(this).attr("id",'_' +i);
                        $(this).attr("name",'_' +i)
                    }
                })
                $("#n").append(newn);
            }) $("#but2").click(function(){
    $("#n>tr:last").remove();
            })
        })
      </script>