如何把剪切板内容粘贴到文本框? window.clipboardData.getData("Text") //可以获得剪贴版的文字window.clipboardData.setData("Text","你的内容") //向剪贴板里写文本信息 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <script> function storeCaret (textEl) {if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate(); }function insertAtCaret (textEl, text) {if (textEl.createTextRange && textEl.caretPos) {var caretPos = textEl.caretPos;caretPos.text =caretPos.text.charAt(caretPos.text.length - 1) == ' ' ?text + ' ' : text; } else textEl.value = text;} function deleteAtCaret (textEl) {if (textEl.createTextRange && textEl.caretPos) {var caretPos = textEl.caretPos;document.selection.clear();}//alert(aForm.aTextArea. } </script> <form name=aForm><input name=aTextArea size=120 wrap=soft onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);" value=这是例子,你可以在这里添加文字、插入文字。> <br> <input type=text name=aText size=80 value=我要在光标处插入这些文字><br><input type=button value=我要在光标处插入上面文本框里输入的文字! onclick="insertAtCaret(this.form.aTextArea, this.form.aText.value);"><input type=button value=删除选中文字 onclick=deleteAtCaret(this.form.aTextArea); id=button1 name=button1></FORM> 让ie6、ie7、ie8支持css3的圆角、阴影样式 弱弱地问一下什么叫鼠标悬浮于页面的某个热点之上 iframe下的SVG在IE中兼容问题 油画 换框 JS 关与aspx与asmx 这两个什么区别。 这段如何用正则表达式 怎样new一个table对象? 关于窗口间刷新的问题 怎样使弹出的窗口不被其它窗口所覆盖 新手学习js,在html中无法显示js编写的内容!求助! 如何实现即关闭本窗口,又刷新上一级窗口? 怎样使复选框取值?在线等待?请您关注!!!
function storeCaret (textEl) {
if (textEl.createTextRange)
textEl.caretPos = document.selection.createRange().duplicate();
}
function insertAtCaret (textEl, text) {
if (textEl.createTextRange && textEl.caretPos) {
var caretPos = textEl.caretPos;
caretPos.text =caretPos.text.charAt(caretPos.text.length - 1) == ' ' ?text + ' ' : text;
}
else
textEl.value = text;
}
function deleteAtCaret (textEl) {
if (textEl.createTextRange && textEl.caretPos) {
var caretPos = textEl.caretPos;
document.selection.clear();
}
//alert(aForm.aTextArea.
}
</script>
<form name=aForm>
<input name=aTextArea size=120 wrap=soft onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);" value=这是例子,你可以在这里添加文字、插入文字。>
<br>
<input type=text name=aText size=80 value=我要在光标处插入这些文字><br>
<input type=button value=我要在光标处插入上面文本框里输入的文字! onclick="insertAtCaret(this.form.aTextArea, this.form.aText.value);">
<input type=button value=删除选中文字 onclick=deleteAtCaret(this.form.aTextArea); id=button1 name=button1>
</FORM>