简体   繁体   English

在不使用Flash的情况下实现ctrl + x与ctrl + c相同的行为

[英]Implement ctrl+x's behaviour same as ctrl+c without use of Flash

In my web application, I need a shortcut ctrl+x to hate the same behavior as ctrl+c when some text in 在我的Web应用程序中,我需要一个快捷键ctrl + x来讨厌与ctrl + c相同的行为

paragraph is selected (selection is not in textarea or text input). 选择了段落(选择不在textarea或文本输入中)。 I need solution without use of Flash. 我需要不使用Flash的解决方案。

First of all you have to prevent the default action on the cut-event. 首先,您必须阻止对cut事件的默认操作。 You can do this the following code: 您可以执行以下代码:

$(document).ready(function(){
      $('#input').live("cut",function(e) {
             e.preventDefault();

      });
    });

Most browsers prevent control of the clipboard. 大多数浏览器阻止控制剪贴板。 Although I know the following jQuery-plugin exists that gives you a bit of control of it: zeroclipboard 虽然我知道存在以下jQuery-plugin,它可以让你对它进行一些控制: zeroclipboard

Note: You must use the Flash add-in you do not want to use to automatically copy text to the client's clipboard. 注意:您必须使用不希望用于自动将文本复制到客户端剪贴板的Flash加载项。 A website automatically modifying the client's clipboard without the aid of active-x components is a security concern. 在没有active-x组件的帮助下自动修改客户端剪贴板的网站是一个安全问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM