我原来做过现成的例子,这议会找不着源代码。但给你提供思路。很简单,
鼠标点击某行,将其存入一个变量,然后,拷贝的实现 就用 obj=TrID.cloneNode(true);
粘贴实现: obj.replaceNode(Tr2ID);TrID 就是选中的行,Tr2ID 待粘贴的行。自己做一个,很简单。我来帮你写个例子

解决方案 »

  1.   

    拷贝列,用 col属性,一样的使用。着你最好自己做一个右键菜单,自定义右键菜单 也很容易,就是 捕获 oncontextmenu 事件就可以实现!如果还有不明白,可以发短信息给我!
      

  2.   

    我的代码如下:<html>
    <head>
    <title>无标题文档</title>
    <script language=javascript>
      function copy_row(){
    obj=row1.cloneNode(true);
    obj.replaceNode(row2);
      }
    </script>
    </head>
    <body>
    <form name="form1" method="post" action="">
      <table width="75%" border="1">
        <tr id=row1> 
          <td>aaaa</td>
          <td>bbbb</td>
          <td>cccc</td>
        </tr>
        <tr id=row2> 
          <td>&nbsp;</td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr> 
          <td>&nbsp;</td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
      </table><input type="button" name="test" value="复制行" onclick="javascript:copy_row()">
     </form>
    </body>
    </html>
      

  3.   

    看我的代码:<TABLE BORDER="1" id=tbl style="border-collapse:collapse" cellspacing=0 cellpadding=0 borderColor='black'>
        <COL STYLE="color:red" id=col1 >
        <COL STYLE="color:blue" id=col2>
        <COL STYLE="color:green" id=col3>
        <TR onmouseover="this.style.backgroundColor='#cceedd'" onmouseout="this.style.backgroundColor=''">
            <TD onclick="col1.style.color=(col1.style.color=='red')?'orange':'red'" onmouseover="this.style.cursor='hand'">点击这里</TD>
            <TD onclick="col2.style.color=(col2.style.color=='blue')?'orange':'blue'" onmouseover="this.style.cursor='hand'">点击这里</TD>
            <TD onclick="col3.style.color=(col3.style.color=='green')?'orange':'green'" onmouseover="this.style.cursor='hand'">点击这里</TD>
        </TR>
        <TR onmouseover="this.style.backgroundColor='#ccddff'" onmouseout="this.style.backgroundColor=''">
            <TD>此列位于第一组。</TD>
            <TD>此列位于第二组。</TD>
            <TD>此列位于第三组。</TD>
        </TR>
         <TR onmouseover="this.style.backgroundColor='#dddddd'" onmouseout="this.style.backgroundColor=''">
            <TD>此列位于第一组。</TD>
             <TD>此列位于第二组。</TD>
            <TD>此列位于第三组。</TD>
        </TR>
            <TR onmouseover="this.style.backgroundColor='#eeeeee'" onmouseout="this.style.backgroundColor=''">
            <TD>此列位于第一组。</TD>
            <TD>此列位于第二组。</TD>
            <TD>此列位于第三组。</TD>
        </TR> <TR onmouseover="this.style.backgroundColor='#cceedd'" onmouseout="this.style.backgroundColor=''">
            <TD>此列位于第一组。</TD>
             <TD>此列位于第二组。</TD>
            <TD>此列位于第三组。</TD>
        </TR> <TR onmouseover="this.style.backgroundColor='#cceedd'" onmouseout="this.style.backgroundColor=''">
            <TD>此列位于第一组。</TD>
             <TD>此列位于第二组。</TD>
            <TD>此列位于第三组。</TD>
        </TR> <TR onmouseover="this.style.backgroundColor='#cceedd'" onmouseout="this.style.backgroundColor=''">
            <TD>此列位于第一组。</TD>
             <TD>此列位于第二组。</TD>
            <TD>此列位于第三组。</TD>
        </TR> <TR onmouseover="this.style.backgroundColor='#cfcfcf'" onmouseout="this.style.backgroundColor=''">
            <TD>此列位于第一组。</TD>
             <TD>此列位于第二组。</TD>
            <TD>此列位于第三组。</TD>
        </tr>
    </TABLE><button id="btn1" onclick="tbl.lastChild.appendChild(tbl.rows(tbl.rows.length-1).cloneNode(true));
    ">添加行</button><button id="btn2">添加列</button>
      

  4.   

    添加列我还没有实现,但你可以注意在每一行添加列。用循环,没有添加行简单!你如果不想添加,想粘贴,可以添加代码如下:<button id="btn1" onclick="tbl.rows(0).replaceNode(tbl.rows(tbl.rows.length-1).cloneNode(true));
    ">添加行</button>
      

  5.   

    你的代码应该改为:
    <script language=javascript>
      function copy_row(){
    obj=row1.cloneNode(true);
    row2.replaceNode(obj);
      }
    </script>