<textarea rows="10" cols="20" onmouseover="select();document.execCommand('copy')">
测试
</textarea>
测试
</textarea>
解决方案 »
- |zyciis| 为什么我的一段跳转代码在Flash中调用没有效果 谢谢
- 请问 javascript 取 radioGroup 该怎么取?
- 如何一次性删除 表格的全部数据
- js小问题,帮帮我,在线等,解决即刻结贴
- 如何用javascript控制表单字体的颜色?
- onkeydown事件怎么写?我要触发enter键?
- 滚动条自动向下
- 怎样在客户端脚本中改变dropdownlist当前选中的值?
- 简单的问题:为什么不响应alert(),程序如下!!
- 我有个javascript显示中文,在IE中显示正常,而在Netscape中就显示成为乱麻了,请问这是什么原因呀?还有好像netscape对 字符并不认可
- 一个简单的问题,关于下拉列表的用法?
- 请问只留下英文,标点符号和回车的正则表达式怎样写?
<style>
.highlighttext{
background-color:yellow;
font-weight:bold;
}
</style><script language="Javascript">
<!--//选择文本框的内容是否需要自动复制到剪切板上
//Applies only to IE 4+
//0=no, 1=yes
var copytoclip=1function HighlightAll(theField) {
var tempval=eval("document."+theField)
tempval.focus()
tempval.select()
if (document.all&©toclip==1){
therange=tempval.createTextRange()
therange.execCommand("Copy")
window.status="选择文本框内容并复制到剪切板上"
setTimeout("window.status=''",1800)
}
}
//-->
</script><body>
<form name="test">
<a class="highlighttext" href="javascript:HighlightAll('test.select1')">
选择并粘贴</a><br>
<textarea name="select1" rows=10 cols=35 >这里是文本框的具体内容</textarea>
</form>
</body>
<input type=button onclick=addText2(demo,"1234") value="AddText">
<script>
function addText2(oTextarea,strText){
//strText是你要加入剪切板的内容.
clipboardData.setData("text",strText);
oTextarea.focus();
document.execCommand("paste");
}
</script>