如何在FIREFOX下实现copy and paste(一百分赠送啊) 楼主实在是有分无处送。稍微 Google 一下就出来了。http://blog.csdn.net/hbcui1984/archive/2006/09/23/1269737.aspx 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我说的是在所见即所得的HTML编辑器里用javascript如何实现 没明白啥意思...在编辑框中直接ctrl+c或者鼠标右键不就粘贴了,你要提供的是啥功能? 是这个意思吗?<textarea id="editor" cols="50" rows="5" onfocus="getPostion()" onmouseup="getPostion()">实现在FIREFOX下利用脚本进行复制和粘贴,本脚本只适用于FIREFOX,如要兼容IE,请利用createTextRange()方法!</textarea><br><input type="button" id="bt_copy" value="复制" onclick="copy()"/><input type="button" id="bt_paste" value="粘贴" onclick="paste()"><script language="JavaScript"><!--var temp=""; //保存复制的字符var insert=0; //粘贴的位置var start=end=0; //选择的起止位置var textBox=btCopy=btPaste=null;window.onload=function(){ textBox = document.getElementById("editor"); btCopy=document.getElementById("bt_copy"); btPaste=document.getElementById("bt_paste"); btPaste.disabled=true;}function copy(){ //复制 start = textBox.selectionStart; end = textBox.selectionEnd; if(start==end) { alert("请选择复制的文字!"); return; } btPaste.disabled=false; temp = textBox.value.substring(start,end);}function paste(){ //粘贴 textBox.value = textBox.value.substr(0, insert) + temp + textBox.value.substr(insert);}function getPostion() //获取插入位置{ insert=textBox.selectionStart;}//--></script> http://codebit.cn/pub/html/javascript/tip/get_selection/兼容性确实麻烦,楼上的在IE下又不行了。 http://blog.csdn.net/hbcui1984/archive/2006/09/23/1269737.aspx JS jq使用post提交后返回数据的处理问题 求助EXT 小键盘输入的问题 如何学数据结构!~ 请问如何用JS读取XML的中文结点啊》|????我的出错,帮忙看一下 如何获取浏览器所在区域? 有没有在FireFox 下编程的 DOM文档对象模型手册,??平时看的手册都是基于IE 的 在WEB页中定制鼠标右键菜单 如何在子窗口内获取框架或者框架上其他子窗口内的变量值 在线等待。修改JS代码。急死了~~~~给分! 请教下 Javascript 代码这样放置可以吗? 发个惠谱的Banner特效
<br>
<input type="button" id="bt_copy" value="复制" onclick="copy()"/><input type="button" id="bt_paste" value="粘贴" onclick="paste()">
<script language="JavaScript">
<!--
var temp=""; //保存复制的字符
var insert=0; //粘贴的位置
var start=end=0; //选择的起止位置
var textBox=btCopy=btPaste=null;window.onload=function(){
textBox = document.getElementById("editor");
btCopy=document.getElementById("bt_copy");
btPaste=document.getElementById("bt_paste");
btPaste.disabled=true;
}function copy(){ //复制
start = textBox.selectionStart;
end = textBox.selectionEnd;
if(start==end)
{
alert("请选择复制的文字!");
return;
}
btPaste.disabled=false;
temp = textBox.value.substring(start,end);
}function paste(){ //粘贴
textBox.value = textBox.value.substr(0, insert) + temp + textBox.value.substr(insert);
}function getPostion() //获取插入位置
{
insert=textBox.selectionStart;
}
//-->
</script>
兼容性确实麻烦,
楼上的在IE下又不行了。