我安装了SimpleTextEditor (http://www.gosu.pl/steditor/),因为它轻巧且易于修改。创建了所有想要的额外模块,但遇到了不幸的事件-我不能为这个编辑器捕捉onpaste事件,使用户只有在从Microsoft Word或浏览器等应用程序复制纯文本时才粘贴它。我试过了
ste.onpaste=function(){}
ste.document.onpaste
ste.document.body.onpaste我甚至尝试过从内部函数--在this.init()
this.frame.document.onpaste=function(){};
this.frame.document.body.onpaste=function(){};
this.frame.onpaste=function(){};
this.onpaste=function(){};这两种方法都不起作用。有人能帮帮我吗?
发布于 2012-01-24 20:43:21
如果您正在寻找通用的解决方案,请尝试jquery
jQuery('#elementId').bind('paste', function(e){ alert('Someone pasted something!') })https://stackoverflow.com/questions/8986805
复制相似问题