<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>
<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>
解决方案 »
- 请教一个关于命名空间理解的问题,是不是就给全局变量和函数变成了某对象的属性和方法了?
- jsp通过foreach迭代出数据,如何将未选中的所有复选框的值(ID)的,同过表单提交到Servlet
- 按钮背景图片问题
- 如何给BBSXP的BBCODE添加[H1]格式或者换tiny_mce编辑器?
- 在opera中如何取得<input type=file name=f>的值?
- 请问如何和javascript控制页面中的realplay组件?
- checkbox在check时,相应什么事件?
- javascript 如何获得最大的整数(javascript能表示的整数有多大) ?
- 请问能否在页面内调用该页面内的一个iframe内的函数方法,谢谢
- js初学者遇到障碍-如果用ajax实现当在页面输入框输入后按搜索按钮 调用接口数据之后返回搜索结果到输入框下面
- 请问,JavaScript 能不能响应鼠标3击事件?
- javascript能否操作键盘
楼上的
你的代码真的假的呀!
ie能让你访问客户端的内存吗?不懂就多学学.
<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>
-------------------------------------------
<!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>
to: rautinee(三个代表宝典)
怎样一次选择一列的多行呢?