请问如何用脚本实现向系统的粘贴板中放入一些字符? <textarea rows="10" cols="20" onmouseover="select();document.execCommand('copy')">测试</textarea> 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 如何选择文本框内容并粘贴到剪切板上<style>.highlighttext{background-color:yellow;font-weight:bold;}</style><script language="Javascript"><!--//选择文本框的内容是否需要自动复制到剪切板上//Applies only to IE 4+//0=no, 1=yesvar 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> <textarea id=demo>abcdef</textarea> <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> 如何下载.wmv视频? 请问下,本论坛中的一个功能是如何实现的呢? realplayer网页播放器有没有鼠标单击事件啊 怎样双击ListBox中的选项得到其值? 关于iframe的问题 JS问题:为何不执行内循环?在线等!! 如何动态生成一表格,并在其单元格里插入不同的内容 求一个最简问题 ListBox如何设readonly? 请教:能不能编写个函数然用户不能使用PrintScreen键。(简单说,就是防止抓屏) 一个简单的问题,关于下拉列表的用法? 请问只留下英文,标点符号和回车的正则表达式怎样写?
<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>