<table>
 <tr><td onclick="bao(this.innerText)">baobao</td><tr>
 <tr><td onclick="bao(this.innerText)">wanghr100</td><tr>
</table>
<input type="text" id="txt">
<input type="button" value="Paste" onclick="Paste2()">
<script>
function bao(str)
{
    clipboardData.setData("text",str); 
    //alert('复制成功');
}
function Paste2()
{
    txt.focus(); 
    document.execCommand("paste"); 
}
</script>

解决方案 »

  1.   

    回复人: SaySorry(天生本王) ( ) 信誉:100  2004-06-29 19:07:00  得分: 0  
    楼上的
    你的代码真的假的呀!
    ie能让你访问客户端的内存吗?不懂就多学学.
      
     
      

  2.   

    要用到dhtml中的clipboardData,你可以参看一下dhtml书籍,上面有的
      

  3.   

    看看是不是这种效果<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <TITLE> New Document </TITLE>
    <META NAME="Generator" CONTENT="EditPlus">
    <META NAME="Author" CONTENT="">
    <META NAME="Keywords" CONTENT="">
    <META NAME="Description" CONTENT="">
    </HEAD>
    <script>
    /*
    @author:rautinee
    http://www.tryitsoft.com
    */
    var oTextRange;
    function selectTR(obj)
    {
    oTextRange=document.body.createTextRange();
    oTextRange.moveToElementText(obj);
    oTextRange.select();
    oTextRange.execCommand("Copy");
    }
    </script>
    <BODY>
    <TABLE border=1>
    <TR onclick="javascript:selectTR(this);" title="单击选择拷贝">
    <TD>1</TD>
    <TD>fdafd</TD>
    </TR>
    <TR onclick="javascript:selectTR(this);" title="单击选择拷贝">
    <TD>2</TD>
    <TD>fdfdsf</TD>
    </TR>
    <TR onclick="javascript:selectTR(this);" title="单击选择拷贝">
    <TD>5</TD>
    <TD>fdaf</TD>
    </TR>
    <TR onclick="javascript:selectTR(this);" title="单击选择拷贝">
    <TD>3</TD>
    <TD>jhg</TD>
    </TR>
    <TR onclick="javascript:selectTR(this);" title="单击选择拷贝">
    <TD>4</TD>
    <TD>jhfhjhg</TD>
    </TR>
    </TABLE>
    </BODY>
    </HTML>
      

  4.   

    我变通了一下,试试
    -------------------------------------------
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <TITLE> New Document </TITLE>
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    function copyCol(obj)
    {
    oTextRange=document.body.createTextRange();
    oTextRange.moveToElementText(obj);
    oTextRange.select();
    oTextRange.execCommand("Copy");
    }
    //-->
    </SCRIPT>
    </HEAD>
    <BODY>
    <table cellPadding=0>
    <tr>
    <td>
    <table border=1 onclick='copyCol(this)'>
    <tr><td>11</td></tr>
    <tr><td>21</td></tr>
    <tr><td>31</td></tr>
    </table>
    </td>
    <td>
    <table border=1 onclick='copyCol(this)'>
    <tr><td>42</td></tr>
    <tr><td>52</td></tr>
    <tr><td>62</td></tr>
    </table>
    </td>
    <td>
    <table border=1 onclick='copyCol(this)'>
    <tr><td>73</td></tr>
    <tr><td>83</td></tr>
    <tr><td>93</td></tr>
    </table>
    </td>
    </tr>
    </table>
    </BODY>
    </HTML>
      

  5.   

    选择列好办啊,把onclick="javascript:selectTR(this);" 代码从<tr>移到<td>中啊
      

  6.   

    能不能不用嵌套表格的办法?
    to: rautinee(三个代表宝典) 
    怎样一次选择一列的多行呢?