【发布时间】:2014-02-28 18:22:56
【问题描述】:
我正在尝试构建一个WYSIWYG,我有三个按钮:copy、cut 和 paste。
我为每个人都尝试了这个脚本,但没有成功。
这是我的脚本:
//Copy
document.getElementById('copy').addEventListener('click', function(){
document.execCommand('copy', false, null);
}, false);
//Cut
document.getElementById('cut').addEventListener('click', function(){
document.execCommand('cut', false, null);
}, false);
//Paste
document.getElementById('paste').addEventListener('click', function(){
document.execCommand('paste', false, null);
}, false);
在Google chrome、Internet Explorer 11、Safari 和Opera 中没有一个工作过,我在控制台中什么也没有。
在Mozilla Firefox 我收到这条消息:
Error: Permission denied for <file://> to get property Clipboard.cutcopy
document.execCommand('cut', false, null);
copy 和 paste 也一样。
我该如何解决这个问题?
【问题讨论】:
标签: javascript wysiwyg